m =. i. 3 4 m 0 1 2 3 4 5 6 7 8 9 10 11 (< 1 2) { m 6The opened left argument is the list 1 2. The first item is 1, and it is used as the index of the 1st axis; the second item is 2, and it is used as the index of the 2nd axis. The 1 selects the list 4 5 6 7 and the 2 selects 6 from that list.

If there are fewer items in the list than there are axes, then all of the trailing axes are selected.

(<1) { m 4 5 6 7This is more interesting with a higher rank array.

d =. i.2 3 4 d 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 (<1 2 3) { d NB. plane 1, row 2, column 3 23 (<1 2) { d NB. plane 1, row 2, all columns 20 21 22 23So far the items in the list of indexes for each axis has been an atom and selects only one index. What if you want more than one index?

If an item in the list of indexes is boxed, then it is a list of indexes for that axis.

Suppose you want to select from m the table of atoms that are in rows 0 2, and columns 0 2 3. That is, the table:

col-0 col-2 col-3 row-0 0 2 3 row-2 8 10 11The indexes for the axes are the list:

0 2 ; 0 2 3 +---+-----+ ¦0 2¦0 2 3¦ +---+-----+That list of indexes needs to be boxed so that each item will be treated as indexes into the successive axes. The 0 2 selects rows (1st axis) and the 0 2 3 selects columns (2nd axis).

< 0 2 ; 0 2 3 +-----------+ ¦+---+-----+¦ ¦¦0 2¦0 2 3¦¦ ¦+---+-----+¦ +-----------+ (< 0 2 ; 0 2 3) { m 0 2 3 8 10 11 (< 0 1 ; 0 2 ; 2 3) { d 2 3 10 11 14 15 22 23Again, if there are fewer items than axes, then all of the trailing axes are selected.

(< 0 1 ; 0 2) { d 0 1 2 3 8 9 10 11 12 13 14 15 20 21 22 23Frequently the desired subarray includes all of an axis that is not a trailing axis. This could be done by giving all indexes for that axis.

(< 0 1 2 ; 2 3) { m 2 3 6 7 10 11This may be inconvenient in a real application where it would necessary to calculate the indexes. For this reason, a boxed empty list, <'', indicates that all indexes in the axis are selected.

< (<'') ; 2 3 +--------+ |+--+---+| ||++|2 3|| ||||| || ||++| || |+--+---+| +--------+The above, used as the left argument will select all indexes along the first axis because the first item is a boxed empty list, and indexes 2 and 3 along the 2nd axis.

(< (<'');2 3) { m 2 3 6 7 10 11The boxed empty list is so useful that the primitive a: is defined as <'' . So, the above can be simplified.

(< a: ; 2 3) { m 2 3 6 7 10 11The above can be even more easily expressed with the rank conjunction.

2 3 {"1 m 2 3 6 7 10 11

>> << Usr Pri JfC LJ Phr Dic Rel Voc !: Help Primer