@LeakyNun BTW keyword arguments always at the end is a convention in almost all languages, I guess it's usually clearer? Because if you have keyword arguments at the start the non-keyword-argument order may seem messed up
Here is an example of abusing the preprocessor to implement a Turing machine. Note that an external build script is needed to feed the preprocessor's output back into its input, so the preprocessor in and of itself isn't Turing complete. Still, it's an interesting project.
From the description...
Although another answer (kinda) suggests otherwise:
Well macros don't directly expand recursively, but there are ways we can work around this.
The easiest way of doing recursion in the preprocessor is to use a deferred expression. A deferred expression is an expression that requires more scans to fully expand:
#define EMPTY()
#define DEFER(id) i...
So it's nice how #if can accept e.g. FOO > 2, but you can't actually decrement a symbol, 4 - 1 is not considered > 2. So you can't really have for loops, which you otherwise could with recursion
CMC: Enclose if simple – [1,2,3] → [[1,2,3]], [[1,2,3]] → [[1,2,3]], [1,2,[3]] → [1,2,[3]], [1] → [[1]] (other explanation: put into list if no child is a list)
@EriktheOutgolfer @Nobody Because often the argument or constructor can be a single simple array or multiple arrays. In order to easily handle such varying input, we can now "enclose if simple" and then process each; {process}¨⊆
@EriktheOutgolfer APL is even more "practical" as it is used for major production systems whereas J is more of an exploratory research oriented language.
@EriktheOutgolfer There's only one datatype in APL; the array. All arrays have a rank which is the number of dimensions. All arrays have a shape which is a list of the lengths of each dimension. Scalars have rank 0 and thus shape [].
@peterh Mathematica is simply not a valid language for fastest-algorithm, in the same sense that a language with a non-deterministic bytecount is not a valid language for code-golf
@Mayube Ok, but the poster declared it as non-competing, and his/her solution seems to me quite interesting, because it looks as a declarative program.
@Mayube However, maybe the flow control commands could be hard.
I've always tought on a full, c++-like OOP language, but without a single reserved word. Instead, all the reserved words should be non-ascii characters.