shen-ruby 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/.gitignore +2 -0
  2. data/.travis.yml +5 -0
  3. data/Gemfile +2 -2
  4. data/HISTORY.md +12 -0
  5. data/README.md +10 -7
  6. data/Rakefile +92 -0
  7. data/bin/srrepl +2 -2
  8. data/k_lambda_spec/primitives/arithmetic_spec.rb +175 -0
  9. data/k_lambda_spec/primitives/assignments_spec.rb +44 -0
  10. data/k_lambda_spec/primitives/generic_functions_spec.rb +115 -2
  11. data/k_lambda_spec/primitives/lists_spec.rb +40 -0
  12. data/k_lambda_spec/primitives/strings_spec.rb +77 -0
  13. data/k_lambda_spec/primitives/symbols_spec.rb +24 -0
  14. data/k_lambda_spec/primitives/vectors_spec.rb +92 -0
  15. data/k_lambda_spec/support/shared_examples.rb +93 -2
  16. data/k_lambda_spec/tail_recursion_spec.rb +30 -0
  17. data/lib/kl/compiler.rb +19 -33
  18. data/lib/kl/environment.rb +1 -0
  19. data/lib/kl/primitives/assignments.rb +1 -0
  20. data/lib/kl/primitives/generic_functions.rb +7 -0
  21. data/lib/kl/primitives/lists.rb +2 -0
  22. data/lib/kl/primitives/strings.rb +13 -5
  23. data/lib/kl/primitives/symbols.rb +1 -0
  24. data/lib/kl/primitives/vectors.rb +5 -0
  25. data/lib/shen_ruby/version.rb +1 -1
  26. data/shen-ruby.gemspec +1 -1
  27. data/shen/lib/shen_ruby/shen.rb +5 -6
  28. data/shen/release/benchmarks/benchmarks.shen +0 -4
  29. data/shen/release/benchmarks/interpreter.shen +2 -2
  30. data/shen/release/benchmarks/plato.jpg +0 -0
  31. data/shen/release/k_lambda/core.kl +171 -1000
  32. data/shen/release/k_lambda/declarations.kl +90 -992
  33. data/shen/release/k_lambda/load.kl +69 -81
  34. data/shen/release/k_lambda/macros.kl +113 -478
  35. data/shen/release/k_lambda/prolog.kl +250 -1307
  36. data/shen/release/k_lambda/reader.kl +115 -996
  37. data/shen/release/k_lambda/sequent.kl +154 -554
  38. data/shen/release/k_lambda/sys.kl +246 -562
  39. data/shen/release/k_lambda/t-star.kl +114 -3643
  40. data/shen/release/k_lambda/toplevel.kl +136 -221
  41. data/shen/release/k_lambda/track.kl +101 -206
  42. data/shen/release/k_lambda/types.kl +143 -298
  43. data/shen/release/k_lambda/writer.kl +93 -106
  44. data/shen/release/k_lambda/yacc.kl +77 -252
  45. data/shen/release/test_programs/README.shen +1 -1
  46. data/shen/release/test_programs/classes-typed.shen +1 -1
  47. data/shen/release/test_programs/interpreter.shen +2 -2
  48. data/shen/release/test_programs/metaprog.shen +2 -2
  49. data/shen/release/test_programs/prolog.shen +79 -0
  50. data/shen/release/test_programs/structures-typed.shen +2 -2
  51. data/shen/release/test_programs/tests.shen +19 -80
  52. data/shen/release/test_programs/yacc.shen +11 -15
  53. metadata +14 -6
  54. data/Gemfile.lock +0 -20
  55. data/shen/release/benchmarks/br.shen +0 -13
@@ -1,548 +1,244 @@
1
+ "**********************************************************************************
2
+ * The License *
3
+ * *
4
+ * The user is free to produce commercial applications with the software, to *
5
+ * distribute these applications in source or binary form, and to charge monies *
6
+ * for them as he sees fit and in concordance with the laws of the land subject *
7
+ * to the following license. *
8
+ * *
9
+ * 1. The license applies to all the software and all derived software and *
10
+ * must appear on such. *
11
+ * *
12
+ * 2. It is illegal to distribute the software without this license attached *
13
+ * to it and use of the software implies agreement with the license as such. *
14
+ * It is illegal for anyone who is not the copyright holder to tamper with *
15
+ * or change the license. *
16
+ * *
17
+ * 3. Neither the names of Lambda Associates or the copyright holder may be used *
18
+ * to endorse or promote products built using the software without specific *
19
+ * prior written permission from the copyright holder. *
20
+ * *
21
+ * 4. That possession of this license does not confer on the copyright holder *
22
+ * any special contractual obligation towards the user. That in no event *
23
+ * shall the copyright holder be liable for any direct, indirect, incidental, *
24
+ * special, exemplary or consequential damages (including but not limited *
25
+ * to procurement of substitute goods or services, loss of use, data, *
26
+ * interruption), however caused and on any theory of liability, whether in *
27
+ * contract, strict liability or tort (including negligence) arising in any *
28
+ * way out of the use of the software, even if advised of the possibility of *
29
+ * such damage. *
30
+ * *
31
+ * 5. It is permitted for the user to change the software, for the purpose of *
32
+ * improving performance, correcting an error, or porting to a new platform, *
33
+ * and distribute the derived version of Shen provided the resulting program *
34
+ * conforms in all respects to the Shen standard and is issued under that *
35
+ * title. The user must make it clear with his distribution that he/she is *
36
+ * the author of the changes and what these changes are and why. *
37
+ * *
38
+ * 6. Derived versions of this software in whatever form are subject to the same *
39
+ * restrictions. In particular it is not permitted to make derived copies of *
40
+ * this software which do not conform to the Shen standard or appear under a *
41
+ * different title. *
42
+ * *
43
+ * It is permitted to distribute versions of Shen which incorporate libraries, *
44
+ * graphics or other facilities which are not part of the Shen standard. *
45
+ * *
46
+ * For an explication of this license see www.shenlanguage.org/license.htm which *
47
+ * explains this license in full. *
48
+ * *
49
+ *****************************************************************************************
50
+ "(defun thaw (V1753) (V1753))
1
51
 
2
- " The License
3
-
4
- The user is free to produce commercial applications with the software, to distribute these applications in source or binary form, and to charge monies for them as he sees fit and in concordance with the laws of the land subject to the following license.
5
-
6
- 1. The license applies to all the software and all derived software and must appear on such.
7
- 2. It is illegal to distribute the software without this license attached to it and use of the software implies agreement
8
- with the license as such. It is illegal for anyone who is not the copyright holder to tamper with or change the license.
9
- 3. Neither the names of Lambda Associates or the copyright holder may be used to endorse or promote products built using
10
- the software without specific prior written permission from the copyright holder.
11
- 4. That possession of this license does not confer on the copyright holder any special contractual obligation towards the user. That in no event shall the copyright holder be liable for any direct, indirect, incidental, special, exemplary or consequential damages (including but not limited to procurement of substitute goods or services, loss of use, data, or profits; or business interruption), however caused and on any theory of liability, whether in contract, strict liability or tort (including negligence) arising in any way out of the use of the software, even if advised of the possibility of such damage.
12
- 5. It is permitted for the user to change the software, for the purpose of improving performance, correcting an error, or porting to a new platform, and distribute the modified version of Shen (hereafter the modified version) provided the resulting program conforms in all respects to the Shen standard and is issued under that title. The user must make it clear with his distribution that he/she is the author of the changes and what these changes are and why.
13
- 6. Derived versions of this software in whatever form are subject to the same restrictions. In particular it is not permitted to make derived copies of this software which do not conform to the Shen standard or appear under a different title.
14
- 7. It is permitted to distribute versions of Shen which incorporate libraries, graphics or other facilities which are not part of the Shen standard.
15
-
16
- For an explication of this license see http://www.lambdassociates.org/News/june11/license.htm which explains this license in full."
17
-
18
- (defun thaw (V650) (V650))
19
-
20
- (defun eval (V651)
21
- (let Macroexpand (shen-walk (lambda V652 (macroexpand V652)) V651)
22
- (if (shen-packaged? Macroexpand)
23
- (map (lambda V653 (shen-eval-without-macros V653))
24
- (shen-package-contents Macroexpand))
25
- (shen-eval-without-macros Macroexpand))))
26
-
27
- (defun shen-eval-without-macros (V654)
28
- (eval-kl (shen-elim-define (shen-proc-input+ V654))))
29
-
30
- (defun shen-proc-input+ (V655)
31
- (cond
32
- ((and (cons? V655)
33
- (and (= input+ (hd V655))
34
- (and (cons? (tl V655))
35
- (and (cons? (tl (tl V655))) (= () (tl (tl (tl V655))))))))
36
- (cons input+
37
- (cons (hd (tl V655)) (cons (shen-rcons_form (hd (tl (tl V655)))) ()))))
38
- ((cons? V655) (map (lambda V656 (shen-proc-input+ V656)) V655)) (true V655)))
39
-
40
- (defun shen-elim-define (V657)
41
- (cond
42
- ((and (cons? V657) (and (= define (hd V657)) (cons? (tl V657))))
43
- (shen-shen->kl (hd (tl V657)) (tl (tl V657))))
44
- ((cons? V657) (map (lambda V658 (shen-elim-define V658)) V657)) (true V657)))
45
-
46
- (defun shen-packaged? (V665)
47
- (cond
48
- ((and (cons? V665)
49
- (and (= package (hd V665))
50
- (and (cons? (tl V665)) (cons? (tl (tl V665))))))
51
- true)
52
- (true false)))
53
-
54
- (defun external (V666)
55
- (trap-error (get V666 shen-external-symbols (value shen-*property-vector*))
56
- (lambda E (interror "package ~A has not been used.~%" (@p V666 ())))))
57
-
58
- (defun shen-package-contents (V669)
59
- (cond
60
- ((and (cons? V669)
61
- (and (= package (hd V669))
62
- (and (cons? (tl V669))
63
- (and (= null (hd (tl V669))) (cons? (tl (tl V669)))))))
64
- (tl (tl (tl V669))))
65
- ((and (cons? V669)
66
- (and (= package (hd V669))
67
- (and (cons? (tl V669)) (cons? (tl (tl V669))))))
68
- (shen-packageh (hd (tl V669)) (hd (tl (tl V669))) Code))
69
- (true (shen-sys-error shen-package-contents))))
70
-
71
- (defun shen-walk (V670 V671)
72
- (cond ((cons? V671) (V670 (map (lambda Z (shen-walk V670 Z)) V671)))
73
- (true (V670 V671))))
74
-
75
- (defun compile (V672 V673 V674)
76
- (let O (V672 (@p V673 ()))
77
- (if (or (= (fail) O) (not (empty? (fst O)))) (shen-compile-error O V674)
78
- (snd O))))
79
-
80
- (defun shen-compile-error (V687 V688)
81
- (cond ((= () V688) (fail))
82
- ((and (tuple? V687) (cons? (fst V687))) (V688 (fst V687)))
83
- (true (interror "syntax error~%" ()))))
84
-
85
- (defun <e> (V693)
86
- (cond ((tuple? V693) (@p (fst V693) ())) (true (shen-sys-error <e>))))
87
-
88
- (defun fail-if (V694 V695) (if (V694 V695) (fail) V695))
89
-
90
- (defun @s (V696 V697) (cn V696 V697))
91
-
92
- (defun tc? (V702) (value shen-*tc*))
93
-
94
- (defun ps (V703)
95
- (trap-error (get V703 shen-source (value shen-*property-vector*))
96
- (lambda E (interror "~A not found.~%" (@p V703 ())))))
97
-
98
- (defun explode (V704)
99
- (if (string? V704) (shen-explode-string V704)
100
- (explode (intmake-string "~A" (@p V704 ())))))
101
-
102
- (defun shen-explode-string (V705)
103
- (cond ((= "" V705) ())
104
- (true
105
- (let S (pos V705 0)
106
- (let Ss (tlstr V705)
107
- (if (= Ss shen-eos) () (cons S (shen-explode-string Ss))))))))
108
-
109
- (defun stinput (V710) (value *stinput*))
110
-
111
- (defun shen-+vector? (V711)
112
- (and (absvector? V711) (> (<-address V711 0) 0)))
113
-
114
- (defun vector (V712)
115
- (let Vector (absvector (+ V712 1))
116
- (let ZeroStamp (address-> Vector 0 V712)
117
- (let Standard
118
- (if (= V712 0) ZeroStamp (shen-fillvector ZeroStamp 1 V712 (fail)))
119
- Standard))))
120
-
121
- (defun shen-fillvector (V713 V714 V715 V716)
122
- (cond ((= V715 V714) (address-> V713 V715 V716))
123
- (true (shen-fillvector (address-> V713 V714 V716) (+ 1 V714) V715 V716))))
124
-
125
- (defun vector? (V718)
126
- (and (absvector? V718)
127
- (trap-error (>= (<-address V718 0) 0) (lambda E false))))
128
-
129
- (defun vector-> (V719 V720 V721)
130
- (if (= V720 0) (interror "cannot access 0th element of a vector~%" ())
131
- (address-> V719 V720 V721)))
132
-
133
- (defun <-vector (V722 V723)
134
- (if (= V723 0) (interror "cannot access 0th element of a vector~%" ())
135
- (let VectorElement (<-address V722 V723)
136
- (if (= VectorElement (fail)) (interror "vector element not found~%" ())
137
- VectorElement))))
138
-
139
- (defun shen-posint? (V724) (and (integer? V724) (>= V724 0)))
140
-
141
- (defun limit (V725) (<-address V725 0))
142
-
143
- (defun symbol? (V726)
144
- (cond ((or (boolean? V726) (or (number? V726) (string? V726))) false)
145
- (true
146
- (trap-error (let Explode (explode V726) (shen-analyse-symbol? Explode))
147
- (lambda E false)))))
148
-
149
- (defun shen-analyse-symbol? (V727)
150
- (cond ((cons? V727) (and (shen-alpha? (hd V727)) (shen-alphanums? (tl V727))))
151
- (true (shen-sys-error shen-analyse-symbol?))))
152
-
153
- (defun shen-alpha? (V728)
154
- (element? V728
155
- (cons "A"
156
- (cons "B"
157
- (cons "C"
158
- (cons "D"
159
- (cons "E"
160
- (cons "F"
161
- (cons "G"
162
- (cons "H"
163
- (cons "I"
164
- (cons "J"
165
- (cons "K"
166
- (cons "L"
167
- (cons "M"
168
- (cons "N"
169
- (cons "O"
170
- (cons "P"
171
- (cons "Q"
172
- (cons "R"
173
- (cons "S"
174
- (cons "T"
175
- (cons "U"
176
- (cons "V"
177
- (cons "W"
178
- (cons "X"
179
- (cons "Y"
180
- (cons "Z"
181
- (cons "a"
182
- (cons "b"
183
- (cons "c"
184
- (cons "d"
185
- (cons "e"
186
- (cons "f"
187
- (cons "g"
188
- (cons "h"
189
- (cons "i"
190
- (cons "j"
191
- (cons "k"
192
- (cons "l"
193
- (cons "m"
194
- (cons "n"
195
- (cons "o"
196
- (cons "p"
197
- (cons "q"
198
- (cons "r"
199
- (cons "s"
200
- (cons "t"
201
- (cons "u"
202
- (cons "v"
203
- (cons "w"
204
- (cons "x"
205
- (cons "y"
206
- (cons "z"
207
- (cons "="
208
- (cons "*"
209
- (cons "/"
210
- (cons "+"
211
- (cons "-"
212
- (cons "_"
213
- (cons "?"
214
- (cons "$"
215
- (cons "!"
216
- (cons "@"
217
- (cons "~"
218
- (cons ">"
219
- (cons "<"
220
- (cons "&"
221
- (cons "%"
222
- (cons "{"
223
- (cons "}"
224
- (cons
225
- ":"
226
- (cons
227
- ";"
228
- (cons
229
- "`"
230
- (cons
231
- "#"
232
- (cons
233
- "'"
234
- (cons
235
- "."
236
- ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
237
-
238
- (defun shen-alphanums? (V729)
239
- (cond ((= () V729) true)
240
- ((cons? V729) (and (shen-alphanum? (hd V729)) (shen-alphanums? (tl V729))))
241
- (true (shen-sys-error shen-alphanums?))))
242
-
243
- (defun shen-alphanum? (V730) (or (shen-alpha? V730) (shen-digit? V730)))
244
-
245
- (defun shen-digit? (V731)
246
- (element? V731
247
- (cons "1"
248
- (cons "2"
249
- (cons "3"
250
- (cons "4"
251
- (cons "5"
252
- (cons "6" (cons "7" (cons "8" (cons "9" (cons "0" ()))))))))))))
253
-
254
- (defun variable? (V732)
255
- (cond ((or (boolean? V732) (or (number? V732) (string? V732))) false)
256
- (true
257
- (trap-error (let Explode (explode V732) (shen-analyse-variable? Explode))
258
- (lambda E false)))))
259
-
260
- (defun shen-analyse-variable? (V733)
261
- (cond
262
- ((cons? V733) (and (shen-uppercase? (hd V733)) (shen-alphanums? (tl V733))))
263
- (true (shen-sys-error shen-analyse-variable?))))
264
-
265
- (defun shen-uppercase? (V734)
266
- (element? V734
267
- (cons "A"
268
- (cons "B"
269
- (cons "C"
270
- (cons "D"
271
- (cons "E"
272
- (cons "F"
273
- (cons "G"
274
- (cons "H"
275
- (cons "I"
276
- (cons "J"
277
- (cons "K"
278
- (cons "L"
279
- (cons "M"
280
- (cons "N"
281
- (cons "O"
282
- (cons "P"
283
- (cons "Q"
284
- (cons "R"
285
- (cons "S"
286
- (cons "T"
287
- (cons "U"
288
- (cons "V"
289
- (cons "W"
290
- (cons "X"
291
- (cons "Y" (cons "Z" ()))))))))))))))))))))))))))))
292
-
293
- (defun gensym (V735)
294
- (concat V735 (set shen-*gensym* (+ 1 (value shen-*gensym*)))))
295
-
296
- (defun concat (V736 V737) (intern (cn (str V736) (str V737))))
297
-
298
- (defun @p (V738 V739)
299
- (let Vector (absvector 3)
300
- (let Tag (address-> Vector 0 shen-tuple)
301
- (let Fst (address-> Vector 1 V738)
302
- (let Snd (address-> Vector 2 V739) Vector)))))
303
-
304
- (defun fst (V740) (<-address V740 1))
305
-
306
- (defun snd (V741) (<-address V741 2))
307
-
308
- (defun tuple? (V742)
309
- (trap-error (and (absvector? V742) (= shen-tuple (<-address V742 0)))
310
- (lambda E false)))
311
-
312
- (defun append (V743 V744)
313
- (cond ((= () V743) V744)
314
- ((cons? V743) (cons (hd V743) (append (tl V743) V744)))
315
- (true (shen-sys-error append))))
316
-
317
- (defun @v (V745 V746)
318
- (let Limit (limit V746)
319
- (let NewVector (vector (+ Limit 1))
320
- (let X+NewVector (vector-> NewVector 1 V745)
321
- (if (= Limit 0) X+NewVector (shen-@v-help V746 1 Limit X+NewVector))))))
322
-
323
- (defun shen-@v-help (V747 V748 V749 V750)
324
- (cond ((= V749 V748) (shen-copyfromvector V747 V750 V749 (+ V749 1)))
325
- (true
326
- (shen-@v-help V747 (+ V748 1) V749
327
- (shen-copyfromvector V747 V750 V748 (+ V748 1))))))
328
-
329
- (defun shen-copyfromvector (V752 V753 V754 V755)
330
- (trap-error (vector-> V753 V755 (<-vector V752 V754)) (lambda E V753)))
331
-
332
- (defun hdv (V756)
333
- (trap-error (<-vector V756 1)
334
- (lambda E
335
- (interror "hdv needs a non-empty vector as an argument; not ~S~%"
336
- (@p V756 ())))))
337
-
338
- (defun tlv (V757)
339
- (let Limit (limit V757)
340
- (if (= Limit 0)
341
- (interror "cannot take the tail of the empty vector~%" ())
342
- (if (= Limit 1) (vector 0)
343
- (let NewVector (vector (- Limit 1))
344
- (shen-tlv-help V757 2 Limit (vector (- Limit 1))))))))
345
-
346
- (defun shen-tlv-help (V758 V759 V760 V761)
347
- (cond ((= V760 V759) (shen-copyfromvector V758 V761 V760 (- V760 1)))
348
- (true
349
- (shen-tlv-help V758 (+ V759 1) V760
350
- (shen-copyfromvector V758 V761 V759 (- V759 1))))))
351
-
352
- (defun assoc (V771 V772)
353
- (cond ((= () V772) ())
354
- ((and (cons? V772) (and (cons? (hd V772)) (= (hd (hd V772)) V771)))
355
- (hd V772))
356
- ((cons? V772) (assoc V771 (tl V772))) (true (shen-sys-error assoc))))
357
-
358
- (defun boolean? (V778)
359
- (cond ((= true V778) true) ((= false V778) true) (true false)))
360
-
361
- (defun nl (V779)
362
- (cond ((= 0 V779) 0) (true (do (intoutput "~%" ()) (nl (- V779 1))))))
363
-
364
- (defun difference (V782 V783)
365
- (cond ((= () V782) ())
366
- ((cons? V782)
367
- (if (element? (hd V782) V783) (difference (tl V782) V783)
368
- (cons (hd V782) (difference (tl V782) V783))))
369
- (true (shen-sys-error difference))))
370
-
371
- (defun do (V784 V785) V785)
372
-
373
- (defun element? (V794 V795)
374
- (cond ((= () V795) false) ((and (cons? V795) (= (hd V795) V794)) true)
375
- ((cons? V795) (element? V794 (tl V795))) (true (shen-sys-error element?))))
376
-
377
- (defun empty? (V801) (cond ((= () V801) true) (true false)))
378
-
379
- (defun fix (V802 V803) (shen-fix-help V802 V803 (V802 V803)))
380
-
381
- (defun shen-fix-help (V810 V811 V812)
382
- (cond ((= V812 V811) V812) (true (shen-fix-help V810 V812 (V810 V812)))))
383
-
384
- (defun put (V814 V815 V816 V817)
385
- (let N (hash V814 (limit V817))
386
- (let Entry (trap-error (<-vector V817 N) (lambda E ()))
387
- (let Change
388
- (vector-> V817 N (shen-change-pointer-value V814 V815 V816 Entry)) V816))))
389
-
390
- (defun shen-change-pointer-value (V820 V821 V822 V823)
391
- (cond ((= () V823) (cons (cons (cons V820 (cons V821 ())) V822) ()))
392
- ((and (cons? V823)
393
- (and (cons? (hd V823))
394
- (and (cons? (hd (hd V823)))
395
- (and (cons? (tl (hd (hd V823))))
396
- (and (= () (tl (tl (hd (hd V823)))))
397
- (and (= (hd (tl (hd (hd V823)))) V821)
398
- (= (hd (hd (hd V823))) V820)))))))
399
- (cons (cons (hd (hd V823)) V822) (tl V823)))
400
- ((cons? V823)
401
- (cons (hd V823) (shen-change-pointer-value V820 V821 V822 (tl V823))))
402
- (true (shen-sys-error shen-change-pointer-value))))
403
-
404
- (defun get (V826 V827 V828)
405
- (let N (hash V826 (limit V828))
406
- (let Entry
407
- (trap-error (<-vector V828 N)
408
- (lambda E (interror "pointer not found~%" ())))
409
- (let Result (assoc (cons V826 (cons V827 ())) Entry)
410
- (if (empty? Result) (interror "value not found~%" ()) (tl Result))))))
411
-
412
- (defun hash (V829 V830)
413
- (let Hash
414
- (shen-mod (sum (map (lambda V831 (string->n V831)) (explode V829))) V830)
415
- (if (= 0 Hash) 1 Hash)))
416
-
417
- (defun shen-mod (V832 V833)
418
- (shen-modh V832 (shen-multiples V832 (cons V833 ()))))
419
-
420
- (defun shen-multiples (V834 V835)
421
- (cond ((and (cons? V835) (> (hd V835) V834)) (tl V835))
422
- ((cons? V835) (shen-multiples V834 (cons (* 2 (hd V835)) V835)))
423
- (true (shen-sys-error shen-multiples))))
424
-
425
- (defun shen-modh (V838 V839)
426
- (cond ((= 0 V838) 0) ((= () V839) V838)
427
- ((and (cons? V839) (> (hd V839) V838))
428
- (if (empty? (tl V839)) V838 (shen-modh V838 (tl V839))))
429
- ((cons? V839) (shen-modh (- V838 (hd V839)) V839))
430
- (true (shen-sys-error shen-modh))))
431
-
432
- (defun sum (V840)
433
- (cond ((= () V840) 0) ((cons? V840) (+ (hd V840) (sum (tl V840))))
434
- (true (shen-sys-error sum))))
435
-
436
- (defun head (V847)
437
- (cond ((cons? V847) (hd V847))
438
- (true (interror "head expects a non-empty list" ()))))
439
-
440
- (defun tail (V854)
441
- (cond ((cons? V854) (tl V854))
442
- (true (interror "tail expects a non-empty list" ()))))
443
-
444
- (defun hdstr (V855) (pos V855 0))
445
-
446
- (defun intersection (V858 V859)
447
- (cond ((= () V858) ())
448
- ((cons? V858)
449
- (if (element? (hd V858) V859) (cons (hd V858) (intersection (tl V858) V859))
450
- (intersection (tl V858) V859)))
451
- (true (shen-sys-error intersection))))
452
-
453
- (defun reverse (V860) (shen-reverse_help V860 ()))
454
-
455
- (defun shen-reverse_help (V861 V862)
456
- (cond ((= () V861) V862)
457
- ((cons? V861) (shen-reverse_help (tl V861) (cons (hd V861) V862)))
458
- (true (shen-sys-error shen-reverse_help))))
459
-
460
- (defun union (V863 V864)
461
- (cond ((= () V863) V864)
462
- ((cons? V863)
463
- (if (element? (hd V863) V864) (union (tl V863) V864)
464
- (cons (hd V863) (union (tl V863) V864))))
465
- (true (shen-sys-error union))))
466
-
467
- (defun y-or-n? (V865)
468
- (let Message (intoutput V865 ())
469
- (let Y-or-N (intoutput " (y/n) " ())
470
- (let Input (intmake-string "~S" (@p (input) ()))
471
- (if (= "y" Input) true
472
- (if (= "n" Input) false
473
- (do (intoutput "please answer y or n~%" ()) (y-or-n? V865))))))))
474
-
475
- (defun not (V866) (if V866 false true))
476
-
477
- (defun subst (V875 V876 V877)
478
- (cond ((= V877 V876) V875)
479
- ((cons? V877) (cons (subst V875 V876 (hd V877)) (subst V875 V876 (tl V877))))
480
- (true V877)))
481
-
482
- (defun cd (V879)
483
- (set *home-directory*
484
- (if (= V879 "") "" (intmake-string "~A/" (@p V879 ())))))
485
-
486
- (defun map (V880 V881) (shen-map-h V880 V881 ()))
487
-
488
- (defun shen-map-h (V884 V885 V886)
489
- (cond ((= () V885) (reverse V886))
490
- ((cons? V885) (shen-map-h V884 (tl V885) (cons (V884 (hd V885)) V886)))
491
- (true (shen-sys-error shen-map-h))))
492
-
493
- (defun length (V887) (shen-length-h V887 0))
494
-
495
- (defun shen-length-h (V888 V889)
496
- (cond ((= () V888) V889) (true (shen-length-h (tl V888) (+ V889 1)))))
497
-
498
- (defun occurrences (V898 V899)
499
- (cond ((= V899 V898) 1)
500
- ((cons? V899) (+ (occurrences V898 (hd V899)) (occurrences V898 (tl V899))))
501
- (true 0)))
502
-
503
- (defun nth (V907 V908)
504
- (cond ((and (= 1 V907) (cons? V908)) (hd V908))
505
- ((cons? V908) (nth (- V907 1) (tl V908))) (true (shen-sys-error nth))))
506
-
507
- (defun integer? (V909)
508
- (and (number? V909)
509
- (let Abs (shen-abs V909) (shen-integer-test? Abs (shen-magless Abs 1)))))
510
-
511
- (defun shen-abs (V910) (if (> V910 0) V910 (- 0 V910)))
512
-
513
- (defun shen-magless (V911 V912)
514
- (let Nx2 (* V912 2) (if (> Nx2 V911) V912 (shen-magless V911 Nx2))))
515
-
516
- (defun shen-integer-test? (V916 V917)
517
- (cond ((= 0 V916) true) ((> 1 V916) false)
518
- (true
519
- (let Abs-N (- V916 V917)
520
- (if (> 0 Abs-N) (integer? V916) (shen-integer-test? Abs-N V917))))))
521
-
522
- (defun mapcan (V920 V921)
523
- (cond ((= () V921) ())
524
- ((cons? V921) (append (V920 (hd V921)) (mapcan V920 (tl V921))))
525
- (true (shen-sys-error mapcan))))
526
-
527
- (defun read-file-as-bytelist (V922)
528
- (let Stream (open file V922 in)
529
- (let Byte (read-byte Stream)
530
- (let Bytes (shen-read-file-as-bytelist-help Stream Byte ())
531
- (let Close (close Stream) (reverse Bytes))))))
52
+ (defun eval (V1754) (let Macroexpand (shen.walk (lambda V1751 (macroexpand V1751)) V1754) (if (shen.packaged? Macroexpand) (map shen.eval-without-macros (shen.package-contents Macroexpand)) (shen.eval-without-macros Macroexpand))))
532
53
 
533
- (defun shen-read-file-as-bytelist-help (V923 V924 V925)
534
- (cond ((= -1 V924) V925)
535
- (true
536
- (shen-read-file-as-bytelist-help V923 (read-byte V923) (cons V924 V925)))))
54
+ (defun shen.eval-without-macros (V1755) (eval-kl (shen.elim-define (shen.proc-input+ V1755))))
537
55
 
538
- (defun read-file-as-string (V926)
539
- (let Stream (open file V926 in) (shen-rfas-h Stream (read-byte Stream) "")))
56
+ (defun shen.proc-input+ (V1756) (cond ((and (cons? V1756) (and (= input+ (hd V1756)) (and (cons? (tl V1756)) (and (cons? (tl (tl V1756))) (= () (tl (tl (tl V1756)))))))) (cons input+ (cons (hd (tl V1756)) (cons (shen.rcons_form (hd (tl (tl V1756)))) ())))) ((cons? V1756) (map shen.proc-input+ V1756)) (true V1756)))
540
57
 
541
- (defun shen-rfas-h (V927 V928 V929)
542
- (cond ((= -1 V928) (do (close V927) V929))
543
- (true (shen-rfas-h V927 (read-byte V927) (cn V929 (n->string V928))))))
58
+ (defun shen.elim-define (V1757) (cond ((and (cons? V1757) (and (= define (hd V1757)) (cons? (tl V1757)))) (shen.shen->kl (hd (tl V1757)) (tl (tl V1757)))) ((and (cons? V1757) (and (= defcc (hd V1757)) (cons? (tl V1757)))) (shen.elim-define (shen.yacc V1757))) ((cons? V1757) (map shen.elim-define V1757)) (true V1757)))
544
59
 
545
- (defun == (V938 V939) (cond ((= V939 V938) true) (true false)))
60
+ (defun shen.packaged? (V1764) (cond ((and (cons? V1764) (and (= package (hd V1764)) (and (cons? (tl V1764)) (cons? (tl (tl V1764)))))) true) (true false)))
61
+
62
+ (defun external (V1765) (trap-error (get V1765 shen.external-symbols (value *property-vector*)) (lambda E (simple-error (cn "package " (shen.app V1765 " has not been used.
63
+ " shen.a))))))
64
+
65
+ (defun shen.package-contents (V1768) (cond ((and (cons? V1768) (and (= package (hd V1768)) (and (cons? (tl V1768)) (and (= null (hd (tl V1768))) (cons? (tl (tl V1768))))))) (tl (tl (tl V1768)))) ((and (cons? V1768) (and (= package (hd V1768)) (and (cons? (tl V1768)) (cons? (tl (tl V1768)))))) (shen.packageh (hd (tl V1768)) (hd (tl (tl V1768))) (tl (tl (tl V1768))))) (true (shen.sys-error shen.package-contents))))
66
+
67
+ (defun shen.walk (V1769 V1770) (cond ((cons? V1770) (V1769 (map (lambda Z (shen.walk V1769 Z)) V1770))) (true (V1769 V1770))))
68
+
69
+ (defun compile (V1771 V1772 V1773) (let O (V1771 (cons V1772 (cons () ()))) (if (or (= (fail) O) (not (empty? (hd O)))) (V1773 O) (shen.hdtl O))))
70
+
71
+ (defun fail-if (V1774 V1775) (if (V1774 V1775) (fail) V1775))
72
+
73
+ (defun @s (V1776 V1777) (cn V1776 V1777))
74
+
75
+ (defun tc? (V1782) (value shen.*tc*))
76
+
77
+ (defun ps (V1783) (trap-error (get V1783 shen.source (value *property-vector*)) (lambda E (simple-error (shen.app V1783 " not found.
78
+ " shen.a)))))
79
+
80
+ (defun stinput () (value *stinput*))
81
+
82
+ (defun shen.+vector? (V1784) (and (absvector? V1784) (> (<-address V1784 0) 0)))
83
+
84
+ (defun vector (V1785) (let Vector (absvector (+ V1785 1)) (let ZeroStamp (address-> Vector 0 V1785) (let Standard (if (= V1785 0) ZeroStamp (shen.fillvector ZeroStamp 1 V1785 (fail))) Standard))))
85
+
86
+ (defun shen.fillvector (V1786 V1787 V1788 V1789) (cond ((= V1788 V1787) (address-> V1786 V1788 V1789)) (true (shen.fillvector (address-> V1786 V1787 V1789) (+ 1 V1787) V1788 V1789))))
87
+
88
+ (defun vector? (V1791) (and (absvector? V1791) (trap-error (>= (<-address V1791 0) 0) (lambda E false))))
89
+
90
+ (defun vector-> (V1792 V1793 V1794) (if (= V1793 0) (simple-error "cannot access 0th element of a vector
91
+ ") (address-> V1792 V1793 V1794)))
92
+
93
+ (defun <-vector (V1795 V1796) (if (= V1796 0) (simple-error "cannot access 0th element of a vector
94
+ ") (let VectorElement (<-address V1795 V1796) (if (= VectorElement (fail)) (simple-error "vector element not found
95
+ ") VectorElement))))
96
+
97
+ (defun shen.posint? (V1797) (and (integer? V1797) (>= V1797 0)))
98
+
99
+ (defun limit (V1798) (<-address V1798 0))
100
+
101
+ (defun symbol? (V1799) (cond ((or (boolean? V1799) (or (number? V1799) (string? V1799))) false) (true (trap-error (let String (str V1799) (shen.analyse-symbol? String)) (lambda E false)))))
102
+
103
+ (defun shen.analyse-symbol? (V1800) (cond ((shen.+string? V1800) (and (shen.alpha? (pos V1800 0)) (shen.alphanums? (tlstr V1800)))) (true (shen.sys-error shen.analyse-symbol?))))
104
+
105
+ (defun shen.alpha? (V1801) (element? V1801 (cons "A" (cons "B" (cons "C" (cons "D" (cons "E" (cons "F" (cons "G" (cons "H" (cons "I" (cons "J" (cons "K" (cons "L" (cons "M" (cons "N" (cons "O" (cons "P" (cons "Q" (cons "R" (cons "S" (cons "T" (cons "U" (cons "V" (cons "W" (cons "X" (cons "Y" (cons "Z" (cons "a" (cons "b" (cons "c" (cons "d" (cons "e" (cons "f" (cons "g" (cons "h" (cons "i" (cons "j" (cons "k" (cons "l" (cons "m" (cons "n" (cons "o" (cons "p" (cons "q" (cons "r" (cons "s" (cons "t" (cons "u" (cons "v" (cons "w" (cons "x" (cons "y" (cons "z" (cons "=" (cons "*" (cons "/" (cons "+" (cons "-" (cons "_" (cons "?" (cons "$" (cons "!" (cons "@" (cons "~" (cons ">" (cons "<" (cons "&" (cons "%" (cons "{" (cons "}" (cons ":" (cons ";" (cons "`" (cons "#" (cons "'" (cons "." ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
106
+
107
+ (defun shen.alphanums? (V1802) (cond ((= "" V1802) true) ((shen.+string? V1802) (and (shen.alphanum? (pos V1802 0)) (shen.alphanums? (tlstr V1802)))) (true (shen.sys-error shen.alphanums?))))
108
+
109
+ (defun shen.alphanum? (V1803) (or (shen.alpha? V1803) (shen.digit? V1803)))
110
+
111
+ (defun shen.digit? (V1804) (element? V1804 (cons "1" (cons "2" (cons "3" (cons "4" (cons "5" (cons "6" (cons "7" (cons "8" (cons "9" (cons "0" ()))))))))))))
112
+
113
+ (defun variable? (V1805) (cond ((or (boolean? V1805) (or (number? V1805) (string? V1805))) false) (true (trap-error (let String (str V1805) (shen.analyse-variable? String)) (lambda E false)))))
114
+
115
+ (defun shen.analyse-variable? (V1806) (cond ((shen.+string? V1806) (and (shen.uppercase? (pos V1806 0)) (shen.alphanums? (tlstr V1806)))) (true (shen.sys-error shen.analyse-variable?))))
116
+
117
+ (defun shen.uppercase? (V1807) (element? V1807 (cons "A" (cons "B" (cons "C" (cons "D" (cons "E" (cons "F" (cons "G" (cons "H" (cons "I" (cons "J" (cons "K" (cons "L" (cons "M" (cons "N" (cons "O" (cons "P" (cons "Q" (cons "R" (cons "S" (cons "T" (cons "U" (cons "V" (cons "W" (cons "X" (cons "Y" (cons "Z" ()))))))))))))))))))))))))))))
118
+
119
+ (defun gensym (V1808) (concat V1808 (set shen.*gensym* (+ 1 (value shen.*gensym*)))))
120
+
121
+ (defun concat (V1809 V1810) (intern (cn (str V1809) (str V1810))))
122
+
123
+ (defun @p (V1811 V1812) (let Vector (absvector 3) (let Tag (address-> Vector 0 shen.tuple) (let Fst (address-> Vector 1 V1811) (let Snd (address-> Vector 2 V1812) Vector)))))
124
+
125
+ (defun fst (V1813) (<-address V1813 1))
126
+
127
+ (defun snd (V1814) (<-address V1814 2))
128
+
129
+ (defun tuple? (V1815) (trap-error (and (absvector? V1815) (= shen.tuple (<-address V1815 0))) (lambda E false)))
130
+
131
+ (defun append (V1816 V1817) (cond ((= () V1816) V1817) ((cons? V1816) (cons (hd V1816) (append (tl V1816) V1817))) (true (shen.sys-error append))))
132
+
133
+ (defun @v (V1818 V1819) (let Limit (limit V1819) (let NewVector (vector (+ Limit 1)) (let X+NewVector (vector-> NewVector 1 V1818) (if (= Limit 0) X+NewVector (shen.@v-help V1819 1 Limit X+NewVector))))))
134
+
135
+ (defun shen.@v-help (V1820 V1821 V1822 V1823) (cond ((= V1822 V1821) (shen.copyfromvector V1820 V1823 V1822 (+ V1822 1))) (true (shen.@v-help V1820 (+ V1821 1) V1822 (shen.copyfromvector V1820 V1823 V1821 (+ V1821 1))))))
136
+
137
+ (defun shen.copyfromvector (V1825 V1826 V1827 V1828) (trap-error (vector-> V1826 V1828 (<-vector V1825 V1827)) (lambda E V1826)))
138
+
139
+ (defun hdv (V1829) (trap-error (<-vector V1829 1) (lambda E (simple-error (cn "hdv needs a non-empty vector as an argument; not " (shen.app V1829 "
140
+ " shen.s))))))
141
+
142
+ (defun tlv (V1830) (let Limit (limit V1830) (if (= Limit 0) (simple-error "cannot take the tail of the empty vector
143
+ ") (if (= Limit 1) (vector 0) (let NewVector (vector (- Limit 1)) (shen.tlv-help V1830 2 Limit (vector (- Limit 1))))))))
144
+
145
+ (defun shen.tlv-help (V1831 V1832 V1833 V1834) (cond ((= V1833 V1832) (shen.copyfromvector V1831 V1834 V1833 (- V1833 1))) (true (shen.tlv-help V1831 (+ V1832 1) V1833 (shen.copyfromvector V1831 V1834 V1832 (- V1832 1))))))
146
+
147
+ (defun assoc (V1844 V1845) (cond ((= () V1845) ()) ((and (cons? V1845) (and (cons? (hd V1845)) (= (hd (hd V1845)) V1844))) (hd V1845)) ((cons? V1845) (assoc V1844 (tl V1845))) (true (shen.sys-error assoc))))
148
+
149
+ (defun boolean? (V1851) (cond ((= true V1851) true) ((= false V1851) true) (true false)))
150
+
151
+ (defun nl (V1852) (cond ((= 0 V1852) 0) (true (do (pr "
152
+ " (stoutput)) (nl (- V1852 1))))))
153
+
154
+ (defun difference (V1855 V1856) (cond ((= () V1855) ()) ((cons? V1855) (if (element? (hd V1855) V1856) (difference (tl V1855) V1856) (cons (hd V1855) (difference (tl V1855) V1856)))) (true (shen.sys-error difference))))
155
+
156
+ (defun do (V1857 V1858) V1858)
157
+
158
+ (defun element? (V1867 V1868) (cond ((= () V1868) false) ((and (cons? V1868) (= (hd V1868) V1867)) true) ((cons? V1868) (element? V1867 (tl V1868))) (true (shen.sys-error element?))))
159
+
160
+ (defun empty? (V1874) (cond ((= () V1874) true) (true false)))
161
+
162
+ (defun fix (V1875 V1876) (shen.fix-help V1875 V1876 (V1875 V1876)))
163
+
164
+ (defun shen.fix-help (V1883 V1884 V1885) (cond ((= V1885 V1884) V1885) (true (shen.fix-help V1883 V1885 (V1883 V1885)))))
165
+
166
+ (defun put (V1887 V1888 V1889 V1890) (let N (hash V1887 (limit V1890)) (let Entry (trap-error (<-vector V1890 N) (lambda E ())) (let Change (vector-> V1890 N (shen.change-pointer-value V1887 V1888 V1889 Entry)) V1889))))
167
+
168
+ (defun shen.change-pointer-value (V1893 V1894 V1895 V1896) (cond ((= () V1896) (cons (cons (cons V1893 (cons V1894 ())) V1895) ())) ((and (cons? V1896) (and (cons? (hd V1896)) (and (cons? (hd (hd V1896))) (and (cons? (tl (hd (hd V1896)))) (and (= () (tl (tl (hd (hd V1896))))) (and (= (hd (tl (hd (hd V1896)))) V1894) (= (hd (hd (hd V1896))) V1893))))))) (cons (cons (hd (hd V1896)) V1895) (tl V1896))) ((cons? V1896) (cons (hd V1896) (shen.change-pointer-value V1893 V1894 V1895 (tl V1896)))) (true (shen.sys-error shen.change-pointer-value))))
169
+
170
+ (defun get (V1899 V1900 V1901) (let N (hash V1899 (limit V1901)) (let Entry (trap-error (<-vector V1901 N) (lambda E (simple-error "pointer not found
171
+ "))) (let Result (assoc (cons V1899 (cons V1900 ())) Entry) (if (empty? Result) (simple-error "value not found
172
+ ") (tl Result))))))
173
+
174
+ (defun hash (V1902 V1903) (let Hash (shen.mod (shen.sum (map (lambda V1752 (string->n V1752)) (explode V1902))) V1903) (if (= 0 Hash) 1 Hash)))
175
+
176
+ (defun shen.mod (V1904 V1905) (shen.modh V1904 (shen.multiples V1904 (cons V1905 ()))))
177
+
178
+ (defun shen.multiples (V1906 V1907) (cond ((and (cons? V1907) (> (hd V1907) V1906)) (tl V1907)) ((cons? V1907) (shen.multiples V1906 (cons (* 2 (hd V1907)) V1907))) (true (shen.sys-error shen.multiples))))
179
+
180
+ (defun shen.modh (V1910 V1911) (cond ((= 0 V1910) 0) ((= () V1911) V1910) ((and (cons? V1911) (> (hd V1911) V1910)) (if (empty? (tl V1911)) V1910 (shen.modh V1910 (tl V1911)))) ((cons? V1911) (shen.modh (- V1910 (hd V1911)) V1911)) (true (shen.sys-error shen.modh))))
181
+
182
+ (defun shen.sum (V1912) (cond ((= () V1912) 0) ((cons? V1912) (+ (hd V1912) (shen.sum (tl V1912)))) (true (shen.sys-error shen.sum))))
183
+
184
+ (defun head (V1919) (cond ((cons? V1919) (hd V1919)) (true (simple-error "head expects a non-empty list"))))
185
+
186
+ (defun tail (V1926) (cond ((cons? V1926) (tl V1926)) (true (simple-error "tail expects a non-empty list"))))
187
+
188
+ (defun hdstr (V1927) (pos V1927 0))
189
+
190
+ (defun intersection (V1930 V1931) (cond ((= () V1930) ()) ((cons? V1930) (if (element? (hd V1930) V1931) (cons (hd V1930) (intersection (tl V1930) V1931)) (intersection (tl V1930) V1931))) (true (shen.sys-error intersection))))
191
+
192
+ (defun reverse (V1932) (shen.reverse_help V1932 ()))
193
+
194
+ (defun shen.reverse_help (V1933 V1934) (cond ((= () V1933) V1934) ((cons? V1933) (shen.reverse_help (tl V1933) (cons (hd V1933) V1934))) (true (shen.sys-error shen.reverse_help))))
195
+
196
+ (defun union (V1935 V1936) (cond ((= () V1935) V1936) ((cons? V1935) (if (element? (hd V1935) V1936) (union (tl V1935) V1936) (cons (hd V1935) (union (tl V1935) V1936)))) (true (shen.sys-error union))))
197
+
198
+ (defun y-or-n? (V1937) (let Message (pr (shen.proc-nl V1937) (stoutput)) (let Y-or-N (pr " (y/n) " (stoutput)) (let Input (shen.app (input) "" shen.s) (if (= "y" Input) true (if (= "n" Input) false (do (pr "please answer y or n
199
+ " (stoutput)) (y-or-n? V1937))))))))
200
+
201
+ (defun not (V1938) (if V1938 false true))
202
+
203
+ (defun subst (V1947 V1948 V1949) (cond ((= V1949 V1948) V1947) ((cons? V1949) (cons (subst V1947 V1948 (hd V1949)) (subst V1947 V1948 (tl V1949)))) (true V1949)))
204
+
205
+ (defun explode (V1951) (shen.explode-h (shen.app V1951 "" shen.a)))
206
+
207
+ (defun shen.explode-h (V1952) (cond ((= "" V1952) ()) ((shen.+string? V1952) (cons (pos V1952 0) (shen.explode-h (tlstr V1952)))) (true (shen.sys-error shen.explode-h))))
208
+
209
+ (defun cd (V1953) (set *home-directory* (if (= V1953 "") "" (shen.app V1953 "/" shen.a))))
210
+
211
+ (defun map (V1954 V1955) (shen.map-h V1954 V1955 ()))
212
+
213
+ (defun shen.map-h (V1958 V1959 V1960) (cond ((= () V1959) (reverse V1960)) ((cons? V1959) (shen.map-h V1958 (tl V1959) (cons (V1958 (hd V1959)) V1960))) (true (shen.sys-error shen.map-h))))
214
+
215
+ (defun length (V1961) (shen.length-h V1961 0))
216
+
217
+ (defun shen.length-h (V1962 V1963) (cond ((= () V1962) V1963) (true (shen.length-h (tl V1962) (+ V1963 1)))))
218
+
219
+ (defun occurrences (V1972 V1973) (cond ((= V1973 V1972) 1) ((cons? V1973) (+ (occurrences V1972 (hd V1973)) (occurrences V1972 (tl V1973)))) (true 0)))
220
+
221
+ (defun nth (V1981 V1982) (cond ((and (= 1 V1981) (cons? V1982)) (hd V1982)) ((cons? V1982) (nth (- V1981 1) (tl V1982))) (true (shen.sys-error nth))))
222
+
223
+ (defun integer? (V1983) (and (number? V1983) (let Abs (shen.abs V1983) (shen.integer-test? Abs (shen.magless Abs 1)))))
224
+
225
+ (defun shen.abs (V1984) (if (> V1984 0) V1984 (- 0 V1984)))
226
+
227
+ (defun shen.magless (V1985 V1986) (let Nx2 (* V1986 2) (if (> Nx2 V1985) V1986 (shen.magless V1985 Nx2))))
228
+
229
+ (defun shen.integer-test? (V1990 V1991) (cond ((= 0 V1990) true) ((> 1 V1990) false) (true (let Abs-N (- V1990 V1991) (if (> 0 Abs-N) (integer? V1990) (shen.integer-test? Abs-N V1991))))))
230
+
231
+ (defun mapcan (V1994 V1995) (cond ((= () V1995) ()) ((cons? V1995) (append (V1994 (hd V1995)) (mapcan V1994 (tl V1995)))) (true (shen.sys-error mapcan))))
232
+
233
+ (defun read-file-as-bytelist (V1996) (let Stream (open file V1996 in) (let Byte (read-byte Stream) (let Bytes (shen.read-file-as-bytelist-help Stream Byte ()) (let Close (close Stream) (reverse Bytes))))))
234
+
235
+ (defun shen.read-file-as-bytelist-help (V1997 V1998 V1999) (cond ((= -1 V1998) V1999) (true (shen.read-file-as-bytelist-help V1997 (read-byte V1997) (cons V1998 V1999)))))
236
+
237
+ (defun read-file-as-string (V2000) (let Stream (open file V2000 in) (shen.rfas-h Stream (read-byte Stream) "")))
238
+
239
+ (defun shen.rfas-h (V2001 V2002 V2003) (cond ((= -1 V2002) (do (close V2001) V2003)) (true (shen.rfas-h V2001 (read-byte V2001) (cn V2003 (n->string V2002))))))
240
+
241
+ (defun == (V2012 V2013) (cond ((= V2013 V2012) true) (true false)))
546
242
 
547
243
  (defun abort () (simple-error ""))
548
244
 
@@ -550,33 +246,21 @@ For an explication of this license see http://www.lambdassociates.org/News/june1
550
246
 
551
247
  (defun input () (eval (read)))
552
248
 
553
- (defun input+ (V945 V946)
554
- (let Input (read)
555
- (let Check (shen-typecheck Input V946)
556
- (if (= false Check)
557
- (do (intoutput "input is not of type ~R: please re-enter " (@p V946 ()))
558
- (input+ : V946))
559
- (eval Input)))))
249
+ (defun input+ (V2019 V2020) (let Input (read) (let Check (shen.typecheck Input V2020) (if (= false Check) (do (pr (cn "input is not of type " (shen.app V2020 ": please re-enter " shen.r)) (stoutput)) (input+ : V2020)) (eval Input)))))
250
+
251
+ (defun bound? (V2021) (and (symbol? V2021) (let Val (trap-error (value V2021) (lambda E shen.this-symbol-is-unbound)) (if (= Val shen.this-symbol-is-unbound) false true))))
252
+
253
+ (defun shen.string->bytes (V2022) (cond ((= "" V2022) ()) (true (cons (string->n (pos V2022 0)) (shen.string->bytes (tlstr V2022))))))
560
254
 
561
- (defun bound? (V947)
562
- (and (symbol? V947)
563
- (let Val (trap-error (value V947) (lambda E shen-this-symbol-is-unbound))
564
- (if (= Val shen-this-symbol-is-unbound) false true))))
255
+ (defun maxinferences (V2023) (set shen.*maxinferences* V2023))
565
256
 
566
- (defun shen-string->bytes (V948)
567
- (cond ((= "" V948) ())
568
- (true (cons (string->n (pos V948 0)) (shen-string->bytes (tlstr V948))))))
257
+ (defun inferences () (value shen.*infs*))
569
258
 
570
- (defun maxinferences (V949) (set shen-*maxinferences* V949))
259
+ (defun protect (V2024) V2024)
571
260
 
572
- (defun inferences (V954) (value shen-*infs*))
261
+ (defun stoutput () (value *stoutput*))
573
262
 
574
- (defun shen-hush (V959)
575
- (cond ((= + V959) (set shen-*hush* shen-hushed))
576
- ((= - V959) (set shen-*hush* shen-unhushed))
577
- (true (interror "'hush' expects a + or a -~%" ()))))
263
+ (defun string->symbol (V2025) (let Symbol (intern V2025) (if (symbol? Symbol) Symbol (simple-error (cn "cannot intern " (shen.app V2025 " to a symbol" shen.s))))))
578
264
 
579
- (defun protect (V960) V960)
580
265
 
581
- (defun shen-stoutput (V965) (value *stoutput*))
582
266