1 | test_assignments = ->
|
2 | run_test [
|
3 |
|
4 |
|
5 | "e",
|
6 | "e",
|
7 |
|
8 |
|
9 |
|
10 | "0=0",
|
11 | "Stop: symbol assignment: error in symbol",
|
12 |
|
13 | "1=2",
|
14 | "Stop: symbol assignment: error in symbol",
|
15 |
|
16 | "3=a",
|
17 | "Stop: symbol assignment: error in symbol",
|
18 |
|
19 |
|
20 |
|
21 | "f(x) = x + 1",
|
22 | "",
|
23 |
|
24 | "g = f",
|
25 | "",
|
26 |
|
27 | "lookup(f)",
|
28 | "function (x) -> x+1",
|
29 |
|
30 | "lookup(g)",
|
31 | "function (x) -> x+1",
|
32 |
|
33 | "f(x,y) = x + 2",
|
34 | "",
|
35 |
|
36 | "lookup(f)",
|
37 | "function (x y) -> x+2",
|
38 |
|
39 | "g(3)",
|
40 | "4",
|
41 |
|
42 | "f(3,0)",
|
43 | "5",
|
44 |
|
45 | "f = quote(1+1)",
|
46 | "",
|
47 |
|
48 | "g = f",
|
49 | "",
|
50 |
|
51 | "g",
|
52 | "2",
|
53 |
|
54 | "g = quote(f)",
|
55 | "",
|
56 |
|
57 | "g",
|
58 | "2",
|
59 |
|
60 | "lookup(g)",
|
61 | "f",
|
62 |
|
63 | "g = lookup(f)",
|
64 | "",
|
65 |
|
66 | "g",
|
67 | "2",
|
68 |
|
69 | "lookup(g)",
|
70 | "1+1",
|
71 |
|
72 |
|
73 |
|
74 | "f := 1+1",
|
75 | "",
|
76 |
|
77 | "lookup(f)",
|
78 | "1+1",
|
79 |
|
80 |
|
81 |
|
82 | "f(x) = x + 1",
|
83 | "",
|
84 |
|
85 | "g(x) = f",
|
86 | "",
|
87 |
|
88 | "g()(2)",
|
89 | "3",
|
90 |
|
91 |
|
92 |
|
93 | "f(x) = x + 1",
|
94 | "",
|
95 |
|
96 | "g(x) = x * x",
|
97 | "",
|
98 |
|
99 | "h(l, x) = l(x)",
|
100 | "",
|
101 |
|
102 | "h(f, 2)",
|
103 | "3",
|
104 |
|
105 | "h(g, 3)",
|
106 | "9",
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 | "f(x) = x + 1",
|
115 | "",
|
116 |
|
117 | "g(x) = x * x",
|
118 | "",
|
119 |
|
120 | "h(l, x) = f(x)",
|
121 | "",
|
122 |
|
123 | "h(f, 2)",
|
124 | "3",
|
125 |
|
126 | "h(g, 3)",
|
127 | "4",
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | "f=quote(f)",
|
133 | "",
|
134 |
|
135 | "g=quote(g)",
|
136 | "",
|
137 |
|
138 | "h=quote(h)",
|
139 | "",
|
140 |
|
141 |
|
142 | "a = a+1",
|
143 | "",
|
144 |
|
145 | "a",
|
146 | "Stop: recursive evaluation of symbols: a -> a",
|
147 |
|
148 |
|
149 | "a := b",
|
150 | "",
|
151 |
|
152 | "b := c",
|
153 | "",
|
154 |
|
155 | "c := a",
|
156 | "",
|
157 |
|
158 | "b",
|
159 | "Stop: recursive evaluation of symbols: b -> c -> a -> b",
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 | "a = b",
|
168 | "",
|
169 |
|
170 | "b = a",
|
171 | "",
|
172 |
|
173 | "a",
|
174 | "b",
|
175 |
|
176 | "b",
|
177 | "b",
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 | "a=a",
|
186 | "",
|
187 |
|
188 | "a := a",
|
189 | "",
|
190 |
|
191 | "a",
|
192 | "a",
|
193 |
|
194 |
|
195 |
|
196 | "clearall",
|
197 | "",
|
198 |
|
199 |
|
200 | ]
|