Indices (whatever is inside the brackets) can be expressions, provided
that when those expressions are finally evaluated, the results are
values that represent valid indices for the array:
B
ABCDEFGHIJKLMNOPQRSTUVWXYZ
XE"1 2 3 4· 5
B[X)(2:J
BDFH.J
x
1231+~:5
B [1'" X)( :3::1
DGJMP
The array from which elements are selected does not have to be a
variable. For example,a vector can be indexed as follows:
2 3 5 7 9 11 13 15 17 19[7 2
~
2::1
13 3 7 3
'ABCDEFGHIJKLMNOPQRSTUVWXYZ '[12
15 15 11 27
16 1]
LOOK PA
DDN
MAI~Y
'ABCDEFGHIJKLMNOPQRSTUVWXYZ '[2
~p~
15
14 27 13 1 18
25]
Indexing a matrix or N-rank array requires an index number for each
coordinate. The index numbers for each coordinate are separated by
semicolons. Suppose M is a 3 by 4 matrix of consecutive integers:
If you ask to see the values of M, they are displayed in the usual
matrix form:
M
1
2
3
' +
I:!"
,J
6
'7
8
9
10
11 1")
.
.:..
If you want to refer to the element in row 2, column 3, you enter:
7
If you want to refer to the third and fourth elements in that row, you
enter:
7 8
APL Language Elements
23