apl>" <-APL2-------------------- sam231.txt ---------------------------->
apl>" <- bracket index ------------------------------------------------->
apl>Lio#0
apl>'curtail'[0 1 3]
cut
apl>Lio#1
apl>'curtail'[1 2 4]
cut
apl>" <- when a vector is indexed -------------------------------------->
apl>a#23 9 6.3 8 -3 7
apl>L#z#a[3]
6.3
apl>Rz
.
apl>L#z#a[2 5 1]
9 -3 23
apl>Rz
3
apl>L#b#2 3R1 4 3 2 6 5
1 4 3
2 6 5
apl>L#q#a[b]
23 8 6.3
9 7 -3.0
apl>Rq
2 3
apl>" <- when a matrix is indexed -------------------------------------->
apl>L#c#3 6R'abcdefghijklmnopqr'
abcdef
ghijkl
mnopqr
apl>L#j#c[2;3]
i
apl>Rj
1
apl>L#p#c[1;3 1 4]
cad
apl>Rp
3
apl>L#m#c[1 2;1 3]
ac
gi
apl>Rm
2 2
apl>L#n#c[1 3;2 3R6 1 3 4 5 2]
fac
deb
rmo
pqn
apl>Rn
2 2 3
apl>" <- eliding index arrays ------------------------------------------>
apl>L#d#3 4Rc[1 2;]
abcd
efgh
ijkl
apl>d[;1]
aei
apl>d[3;]
ijkl
apl>" <- repetitions of index values ----------------------------------->
apl>L#h#2 4R3 4 1 2 2 3 4 1
3 4 1 2
2 3 4 1
apl>'emit'[h]
item
mite
apl>'nab'[3 2 1 2 1 2]
banana
apl>" <- when a higher-rank array is indexed --------------------------->
apl>L#u#2 3 4R(,c),'stuvwx'
abcd
efgh
ijkl
mnop
qrst
uvwx
apl>u[1;2;4]
h
apl>u[2;1;1 3 4]
mop
apl>u[;2;4]
ht
apl>u[1;1 3;2 4]
bd
jl
apl>u[1;;3]
cgk
apl>u[2;1;]
mnop
apl>u[;3;]
ijkl
uvwx
apl>" <- when a nested array is indexed -------------------------------->
apl>L#v#'h' 'hi' ('him' 'his')
h hi him his
apl>L#z#v[1]
h
apl>`=z
1
apl>RRz
0
apl>L#e#v[2]
hi
apl>`=e
2
apl>L#s#v[3]
him his
apl>`=s
3
apl>RRs
0
apl>" <- selective specification --------------------------------------->
apl>Rv
3
apl>`=v
3
apl>v[3]#'h'
apl>v
h hi h
apl>`=v
2
apl>w#2 3R'abcdef'
apl>w[1;1 3]#8 9
apl>w
8 b 9
d e f
apl>b#3 4 5
apl>b[]#9
apl>b
9 9 9
apl>)off