>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  Primer

Array

Atoms, lists, and tables are all arrays. All nouns in J are arrays. Atoms have 0 dimensions, lists have 1 dimension, and tables have 2 dimensions. This extends to higher dimension arrays.

The primitive $, discussed earlier with lists and tables also works with higher dimension arrays.

   2 3 4 $ i. 24
 0  1  2  3
 4  5  6  7
 8  9 10 11

12 13 14 15
16 17 18 19
20 21 22 23

The above is a 3-dimensional array. The blank line indicates the break between the 1st dimension and the 2nd and 3rd.

   b =. 2 3 4 $ 'abcdef'
   $ b
2 3 4

The monad i. also works with higher dimension arrays.

   i. 2 3 4
 0  1  2  3
 4  5  6  7
 8  9 10 11

12 13 14 15
16 17 18 19
20 21 22 23

The J terms atom, list, and table are analogous to the math terms of scalar, vector, and matrix.


>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  Primer