3 ms·
In my golf language, called stax, each program expressible in plain ASCII has a corresponding representation in a single byte character set. [0] The only reaso
by recursive 3y ago
In my golf language, called stax, each program expressible in plain ASCII has a corresponding representation in a single byte character set. [0] The only reason a program wouldn't start in plain ASCII is the contents of string literals.
The alternate representation generally saves ~15%, as measured in bytes. However, I totally understand the argument about human-unreadable "golfed" code, which is why you can always use the plain ASCII representation if you want.
For instance, you can print fibonacci numbers in an infinite loop using this program. [1]
10Wb+Q
It pushes one and zero to the stack. Then `W` repeats the rest of the program forever. `b+` copies the top 2 elements from the stack and adds them. `Q` peeks from the stack and prints to output. This program packs down to `╪Ç►╢0` for a savings of 1 byte (using the languages own impractical character encoding).
[0] https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax https://github.com/tomtheisen/stax/blob/master/docs/packed.m...
[1] https://staxlang.xyz/#c=10Wb%2BQ&i= https://staxlang.xyz/#c=10Wb%2BQ&i=