1 if ?get ('amatrix, 'present) = false then load (amatrix) else 'already_loaded;
3 "... Hilbert matrix ..."$
5 foo : make_matrix (7, 5)$
6 for i thru foo@nr do for j thru foo@nc do foo [i, j] : 1/(i + j - 1);
9 "... Integer subscripts ..."$
17 "... 'all subscripts ..."$
26 mumble : foo [1, all];
28 "... Collective assignment ..."$
34 foo [all, 5] : foo [all, 1];
38 "... Implicit subscript=1 when #rows=1 or #columns=1 ..."$
46 "... Copy-on-write policy ..."$
56 "... List of integers subscripts ..."$
62 foo [[5, 6, 7], [2, 5]];
64 "... amatrix of Boolean values subscripts ..."$
66 baz : amatrixmap (lambda ([x], is (x > 3/10)), bar);
68 quux : amatrixmap (lambda ([x], is (x < 1/4)), bar);
70 blurf : amatrixmap (lambda ([x], is (x < 1/2)), mumble);
72 snort : amatrixmap (lambda ([x], is (x >= 1/3)), mumble);
84 foo [[2, 3, 6], blurf];
88 "... Relational expressions subscripts ..."$
96 foo [6, 3/4 >= mumble];
100 foo [all, mumble < 1/2];
102 foo [bar # 1/2, [5, 2]];
104 foo [[4, 3, 2], mumble < 3/7];
106 foo [bar <= 7/8, blurf];
108 foo [baz, mumble > 1/8];
110 foo [bar > 2/7, 8/9 >= mumble];
112 "... Boolean expressions subscripts ..."$
116 foo [7, blurf and snort];
118 foo [baz and not quux, all];
120 foo [all, not blurf or snort];
122 foo [baz or quux, [1, 2, 4]];
124 foo [[3, 2, 5], not blurf and snort];
126 foo [quux and baz, snort];
128 foo [quux, not blurf];
130 foo [not quux and not baz, mumble < 0.95];
132 foo [bar > 0.15, not blurf or not snort];
134 foo [quux or baz, blurf or not snort];