File: rtest1a.mac

package info (click to toggle)
maxima 5.47.0-9
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 193,104 kB
  • sloc: lisp: 434,678; fortran: 14,665; tcl: 10,990; sh: 4,577; makefile: 2,763; ansic: 447; java: 328; python: 262; perl: 201; xml: 60; awk: 28; sed: 15; javascript: 2
file content (140 lines) | stat: -rw-r--r-- 2,864 bytes parent folder | download | duplicates (3)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
(use_fast_arrays:true,array(bil,3),0);
0$
bil[1];
false;
bil[1]:3;
3;
bil[1];
3;
listarray(bil);
[false, 3, false,false];
arrayinfo(bil);
[declared, 1, [3]];
ha[1]:2;
2;
ha[3];
false;
arrayinfo(ha);
[hash_table, 1, 1];
use_fast_arrays:false;
false;
array(bil1,3);
bil1;
bil1[2];
bil1[2];
bil1[2]:3;
3;
bil1[2];
3;
listarray(bil1);
[''?munbound,''?munbound,3,''?munbound];
arrayinfo(bil1);
[declared, 1, [3]];
oldha[1]:8;
8;
oldha[2];
oldha[2];
arrayinfo(oldha);
[hashed, 1, [1]];
use_fast_arrays:true;
true;
bilx[n]:=n*bilx[n-1];
bilx[n]:=n*bilx[n-1];
bilx[0]:1;
1;
bilx[3];
6;

use_fast_arrays: false;
false;

block ([use_fast_arrays : true], kill (foo), foo [2] : 'x, foo [3] : 'y, foo [5] : 'z, foo [7] : 'a, sort (listarray (foo)));
[a, x, y, z];

/* Bug #2978: "kill(a[i])" doesn't work with fast arrays */

block ([use_fast_arrays : true,
        y : yvalue],
  local (y),
  kill (foo),
  foo ['x] : 'x,
  foo ['y] : 'y,
  foo [ y] :  y,
  foo ['z] : 'z,
  /* Check that indices get evaluated */
  kill (foo ['y]),
  kill (foo [ y]),
  sort (listarray (foo)));
[x, z];

block ([use_fast_arrays : true,
        y : yvalue],
  local (y),
  kill (foo),
  foo [1, 'x] : 'x,
  foo [2, 'y] : 'y,
  foo [2,  y] :  y,
  foo [3, 'z] : 'z,
  /* Check that indices get evaluated */
  kill (foo [2, 'y]),
  kill (foo [2,  y]),
  sort (listarray (foo)));
[x, z];

/* kill(all) erases display properties for conjugate
 * mailing list 2017-02-24: "kill(all) results in non-default display options in wxMaxima"
 * Verify here that properties list for conjugate and friends is not reset by kill(all),
 * but it is reset by kill(foo) where foo = conjugate or friend.
 */

(?putprop ('conjugate, 111, 'foo),
 ?putprop (nounify ('erf_generalized), 222, 'bar),
 ?putprop ('beta, 333, 'baz),
 ?putprop ('nset, 444, 'quux),
 ?putprop ('maxmin, 666, 'blurf),
 ?putprop ('nummod, 777, 'barf),
 0);
0;

kill(all);
done;

[?get ('conjugate, 'foo),
 ?get (nounify ('erf_generalized), 'bar),
 ?get ('beta, 'baz),
 ?get ('nset, 'quux),
 ?get ('maxmin, 'blurf),
 ?get ('nummod, 'barf)];
[111, 222, 333, 444, 666, 777];

(kill (conjugate),
 apply (kill, [nounify ('erf_generalized)]),
 kill (beta),
 kill (nset, maxmin, nummod),
 0);
0;

[?get ('conjugate, 'foo),
 ?get (nounify ('erf_generalized), 'bar),
 ?get ('beta, 'baz),
 ?get ('nset, 'quux),
 ?get ('maxmin, 'blurf),
 ?get ('nummod, 'barf)];
[false, false, false, false, false, false];

/* verify that props is empty after kill(all) -- pre-bugfix behavior is that props
 * has several built-in symbols before and after kill(all)
 */

/* this test fails due to bug in kill(rules); see SF bug #3289 */
(kill(all), props);
[];

/* workaround bug #3289 */
(kill(all),
 not some (lambda ([x], member (x, props)),
           ['conjugate, nounify ('erf_generalized), 'beta, 'nset, 'maxmin, 'nummod]));
true;

(reset(use_fast_arrays),1);
1;