by Pompidou · 2y ago · 0 comments
For instance: Eratosthene's sieve to get all prime under 100 : " (-.] * /])2}.i.100 " Another great property of J is his natural language like structure :
without =: -.
multiplied_by =: */
upto =: 4 : 'x}.i.1+y'
Sieve_100 =: (2 upto 100) without (2 upto 100) multiplied_by (2 upto 100)
Fyi: for a while now, j has supported the more convenient 'direct definition' syntax. You can now write that definition like:
upto =: {{ x}.i.1+y }}
It will automatically make a monad or a dyad depending on whether you use x or not (or an adverb or a conjunction if you use u or m or v or n).
For whatever it's worth, R specifically is almost entirely arrays, with the exception of NULL.
Even language constructs like functions, including source code itself, are represented as heterogeneous arrays (called "lists"). I'd go so far as to claim that R is an homoiconic array language.