Comments on Source with the whole alphabet in order of appearance
Parent
Source with the whole alphabet in order of appearance
The challenge is to write as short a source as possible, where the English alphabet (in alphabetical order from top to bottom) "abcdefghijklmnopqrstuvwxyz"
is a sub-sequence of the source code.
The first mentioning of the next expected letter is the only one that counts. If a letter appears earlier on than expected, then it does not count.
That is: if the letter a
is the next expected letter, then in the source b;abs;c;
the a
counts and everything before it is ignored. The next expected letter in the alphabet is b
, which is found immediately as the next letter in abs
. That a b
existed earlier on in the source has no relevance. Similarly, the s
at the end of abs
fills no purpose as the next expected letter is now c
. And so on, until the whole alphabet has been found in the source.
- Identifiers, variable/function names, string literals, integer/floating point constants (like 0xABCDEF) or anything else that can be named by the programmer do not count towards iterating through the alphabet.
- Only keywords, function names or identifiers provided by the language's standard/default libraries count.
- A solution may use non-standard libraries in which case it becomes a separate "language x + library y" solution.
- Comments are not allowed anywhere in the source.
- The program need not do anything meaningful but must compile cleanly (no language syntax or constraint violations etc) and execute without any crashes or exceptions thrown.
- Function-only answers are accepted and encouraged.
- Any library includes at the top of the program are free and do not count towards the total (if using tio.run, you may put such in the header section).
- The challenge is case-insensitive, accepting both upper and lower case letters.
- This is code golf, the shortest source that fulfil the requirements wins.
Non-golfed example of a correct solution in standard C:
C (gcc), 217 bytes
void func (void)
{
fabs;cos;
#define x long
acosh;
printf("hello world");
jmp_buf j;
isblank;
long _Atomic l;
alignof(int);
puts;
qsort;qsort;
NULL;
(void)pow;
fmax;
INFINITY;
sizeof j;
}
To go through this source, func
is an identifier and does not contribute to the solution (but to the total amount of characters for code golf like usual). Neither does x
, "hello world"
etc. We find the alphabet as follows (bold text):
void func (void) { fabs;cos; #define x long acosh; printf("hello world"); jmp_buf j; isblank; long _Atomic l; alignof(int); puts; qsort;qsort; NULL; (void)pow; fmax; INFINITY; sizeof j; }
Vyxal, 27 bytes ``` Qabcd …
18d ago
Python, 88 bytes ```python …
18d ago
Bash + a ton of non-standard p …
18d ago
Japt, 26 bytes aBcDeFgH …
15d ago
TI-BASIC, 23 bytes Like lyx …
5d ago
Post
TI-BASIC, 23 bytes
Like lyxal's answer, this program exits immediately, so nothing after the Stop
is executed.
The program
Stop
GarbageCollectDetectAsymOffDispGraphiconj(BLACKClrfHomenormalpdf(SeqaClrAllListsFullvwAxesgetKeyZStandard
For those who are wondering, the reason this program is less than 26 bytes is that in TI-BASIC, while the user is shown long words for builtins like DispGraph
, what's actually being stored in the program memory is a smaller number of bytes. So, while BLACK
is five characters long, behind the scenes it's a number that's two bytes in memory.
As a result, builtin functions and variables and such are treated as single characters when editing. So pressing the del
key once would delete the entire word BLACK
.
1 comment thread