/usr/share/maxima/5.41.0/tests/rtestdefstruct.mac is in maxima-test 5.41.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | kill (all);
done;
defstruct (mumble ());
[mumble ()];
f: new (mumble);
mumble ();
defstruct (bar (aa, bb), baz (aa), quux (aa));
[bar (aa, bb), baz (aa), quux (aa)];
defstruct (foo (aa, bb, cc = bar (2, 3), dd = baz (5), ee = quux (7)));
[foo (aa, bb, bar (2, 3), baz (5), quux (7))];
f: new (foo);
foo (aa, bb, bar (2, 3), baz (5), quux (7));
g: f@cc;
bar (2, 3);
g@bb: blurf (11);
blurf (11);
f;
foo (aa, bb, bar (2, blurf (11)), baz (5), quux (7));
g: new (''f);
foo (aa, bb, bar (2, blurf (11)), baz (5), quux (7));
g@bb: [1, 2, 3];
[1, 2, 3];
g;
foo (aa, [1, 2, 3], bar (2, blurf (11)), baz (5), quux (7));
f;
foo (aa, bb, bar (2, blurf (11)), baz (5), quux (7));
f@4@1: %pi - 3;
%pi - 3;
f;
foo (aa, bb, bar (2, blurf (11)), baz (%pi - 3), quux (7));
structures;
[mumble(), bar(aa, bb), baz(aa), quux(aa), foo(aa, bb, bar(2, 3), baz(5), quux(7))];
map (lambda ([a], ?get (op (a), ?defstruct\-template)), structures);
[mumble(), bar(aa, bb), baz(aa), quux(aa), foo(aa, bb, cc, dd, ee)];
kill (mumble, foo, bar, baz);
done;
errcatch (new (baz));
[];
structures;
[quux(aa)];
new (quux);
quux (aa);
/* begin stuff to test parallel multiple assignment */
[a, b, c]: [x, y, z];
[x, y, z];
[x, y, z]: [11, 22, 33];
[11, 22, 33];
[''a, ''b, ''c];
[11, 22, 33];
[x, y, z]: x*y*z;
[7986, 7986, 7986];
[x, y, z];
[7986, 7986, 7986];
[aa, bb]: [bb, 2*aa];
[bb, 2*aa];
([aa, bb]: [bb, 2*aa], [aa, bb]: [bb, 2*aa], [aa, bb]: [bb, 2*aa], [aa, bb]: [bb, 2*aa]);
[4*bb, 8*aa];
(kgcd (a, b) := (while b#0 do [a, b]: [b, remainder (a, b)], abs(a)), 0);
0;
kgcd (123456, 123);
''(gcd (123456, 123));
/* Error on atomic argument */
errcatch (defstruct (xx));
[];
/* Error on malformed record initializer */
errcatch (defstruct (xx (1)));
[];
|