git @ Cat's Eye Technologies Quylthulg / 05e9b2a
Fix example programs and insert them into the test suite. Chris Pressey 4 years ago
4 changed file(s) with 54 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
0 foreach $x$ = [10, 20, 40, 80, 60, 10, 30]
0 foreach $x$ = [10, 20, 40, 80]
11 with $a$ = null be
22 ,$x$,$a$,
33 else be
33 with $r$=99999 be
44 ,,$x$,<$a$<null<,,>>$a$>null>>null>,
55 else be
6 $a$
6 abort
77 else be
88 null
33 with $r$=99999 be
44 ,,$x$,<$a$<null<,,>>$a$>null>>null>,
55 else be
6 $a$
6 abort
77 else be
88 null
1313 -> shell command
1414 -> "bin/qlzqqlzuup %(test-body-file)"
1515
16 -> Functionality "Interpret Quylthulg Program" is implemented by
17 -> shell command
18 -> "bin/qlzqqlzuup -m %(test-body-file)"
19
1620 Integer expressions.
1721 --------------------
1822
145149 | else be null
146150 = Null
147151
152 Some list-processing-type things that you often see in functional
153 programming.
154
155 Reverse a list.
156
157 | foreach $x$ = [10, 20, 40, 80]
158 | with $a$ = null be
159 | ,$x$,$a$,
160 | else be
161 | null
162 = Cons (Int 80) (Cons (Int 40) (Cons (Int 20) (Cons (Int 10) Null)))
163
164 Find the length and the sum of a list of integers.
165
166 | foreach $x$ = [10, 20, 40]
167 | with $a$ = ,0,0, be
168 | ,+<$a$<0<+1+,+>$a$>0>+$x$+,
169 | else be
170 | null
171 = Cons (Int 3) (Int 70)
172
173 Take the first 3 elements from a list (in reverse order.)
174
175 | foreach $x$ = [10, 20, 40, 80, 60, 10, 30]
176 | with $a$ = ,null,[1,1,1,1], be
177 | foreach $n$=>>$a$>null>>null>
178 | with $r$=99999 be
179 | ,,$x$,<$a$<null<,,>>$a$>null>>null>,
180 | else be
181 | abort
182 | else be
183 | null
184 = Cons (Cons (Int 40) (Cons (Int 20) (Cons (Int 10) Null))) (Cons (Int 1) Null)
185
186 Take the first 5 elements from a cyclic list.
187
188 | foreach $x$ = :L:[10, 20, goto $L$]
189 | with $a$ = ,null,[1,1,1,1,1,1], be
190 | foreach $n$=>>$a$>null>>null>
191 | with $r$=99999 be
192 | ,,$x$,<$a$<null<,,>>$a$>null>>null>,
193 | else be
194 | abort
195 | else be
196 | null
197 = Cons (Cons (Int 10) (Cons (Int 20) (Cons (Int 10) (Cons (Int 20) (Cons (Int 10) Null))))) (Cons (Int 1) Null)
198
148199 Macros.
149200 -------
150201