@Vortico also, arrays are easy in J for different reasons than they are easy in Python. For example, to set up a list of numbers you simply need to set up a sequence of numbers separated by spaces, such as
p =. 0 1 2 3 8 9 4
to make a multi-dimensional array, you simply need to specify dimensions using the $ operator dyadically (arguments on either side) in the following format
p =. 3 3 3 $ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 (...) 27
(although a list such as this one could be more easily created by invoking the primitive i. monadically – single argument – with the number 27, which is usually used to cycle through arrays without the use of a loop)
p =. 3 3 3 $ i.27
The above array would be displayed (by simply writing the array name alone on a line) as:
0 1 2——9 10 11——18 19 20
3 4 5——12 13 14—- 21 22 23
6 7 8——15 16 17—- 24 25 26
(with better spacing, of course).
arrays of any dimensions are a bit like matrices in that they can simply be added together, provided they have the same dimensions:
1 2 3 + 4 5 6
yields the result
5 7 9
Single (0-dimensional) arrays can also be used with any array with similar ease:
5 * 1 2 3
yields the result
5 10 15
Same goes for other operators and even “verbs” (functions) you design yourself.
Also worth noting are “adverbs”, which modify the verbs themselves, such as the / adverb, which effectively places the verb between each item in a list (as J is an interpreted rather than compiled language, this isn’t exactly what happens; it doesn’t modify the actual compiled code as would a preprocessor directive in C)
as such, the simple verb below would yield the sum of any array:
sum =. +/
similarly, the following verb would return the highest value in any array:
greatestVal =. >./
did I mention the notation for writing functions is that easy?