4
4
/* useful for manipulating matrices, arrays, and arbitrary dimension and */
5
5
/* order data objects constructed as lists of lists of lists... */
7
SUBSCRMAP:TRUE /* This enables subscript mapping */;
8
a[[x1,x2],[y1,y2]] /* Map a[x,x] over the subscripts */;
7
subscrmap:true /* this enables subscript mapping */;
8
a[[x1,x2],[y1,y2]] /* map a[x,x] over the subscripts */;
9
9
m:matrix([a,b],[c,d]) /* enter a matrix */;
10
M[[1,1,1],[[1,1],[2,2]]] /* Create a new structure from M */;
11
af[i,j]:=x^(i+j) /* Define a generating function */;
12
iota(n):= /* index list generator like APL */
10
m[[1,1,1],[[1,1],[2,2]]] /* create a new structure from m */;
11
af[i,j]:=x^(i+j) /* define a generating function */;
12
iota(n):= /* index list generator like apl */
14
14
for i:1 thru n do l:endcons(i,l),
16
16
il:iota(8) /* generate an index vector 8 long */;
17
af[il,il],eval /* Construct a structure */;
17
af[il,il],eval /* construct a structure */;
18
18
apply(matrix,%) /* make it a matrix */;
22
22
matrix(m[[1,2],[1]]),eval /* select a column */;
23
23
matrix(m[[2,1],''(iota(length(m[1])))]),eval /* select all of one dimension */;
24
24
a['[1,2]] /* use a list as a hashed ary subscript*/;
25
ARR[[1,2,3,4]]::0.0 /* Assignment. Note use of :: */;
25
arr[[1,2,3,4]]::0.0 /* assignment. note use of :: */;