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,94 +1,82 @@
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 load (V808) (let Load (let Start (get-time run) (let Result (shen.load-help (value shen.*tc*) (read-file V808)) (let Finish (get-time run) (let Time (- Finish Start) (let Message (pr (cn "
51
+ run time: " (cn (str Time) " secs
52
+ ")) (stoutput)) Result))))) (let Infs (if (value shen.*tc*) (pr (cn "
53
+ typechecked in " (shen.app (inferences) " inferences
54
+ " shen.a)) (stoutput)) shen.skip) loaded)))
1
55
 
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.
56
+ (defun shen.load-help (V813 V814) (cond ((= false V813) (map (lambda X (pr (shen.app (shen.eval-without-macros X) "
57
+ " shen.s) (stoutput))) V814)) (true (let RemoveSynonyms (mapcan shen.remove-synonyms V814) (let Table (mapcan shen.typetable RemoveSynonyms) (let Assume (map shen.assumetype Table) (trap-error (map shen.typecheck-and-load RemoveSynonyms) (lambda E (shen.unwind-types E Table)))))))))
15
58
 
16
- For an explication of this license see http://www.lambdassociates.org/News/june11/license.htm which explains this license in full."
59
+ (defun shen.remove-synonyms (V815) (cond ((and (cons? V815) (= shen.synonyms-help (hd V815))) (do (eval V815) ())) (true (cons V815 ()))))
17
60
 
18
- (defun load (V1645)
19
- (let Load
20
- (let Start (get-time run)
21
- (let Result (shen-load-help (value shen-*tc*) (read-file V1645))
22
- (let Finish (get-time run)
23
- (let Time (- Finish Start)
24
- (let Message (intoutput "~%run time: ~A secs~%" (@p Time ()))
25
- Result)))))
26
- (let Infs
27
- (if (value shen-*tc*)
28
- (intoutput "~%typechecked in ~A inferences~%" (@p (inferences _) ()))
29
- shen-skip)
30
- loaded)))
61
+ (defun shen.typecheck-and-load (V816) (do (nl 1) (shen.typecheck-and-evaluate V816 (gensym A))))
31
62
 
32
- (defun shen-load-help (V1650 V1651)
33
- (cond
34
- ((= false V1650)
35
- (map (lambda X (intoutput "~S~%" (@p (shen-eval-without-macros X) ())))
36
- V1651))
37
- (true
38
- (let RemoveSynonyms
39
- (mapcan (lambda V1652 (shen-remove-synonyms V1652)) V1651)
40
- (let Table (mapcan (lambda V1653 (shen-typetable V1653)) RemoveSynonyms)
41
- (let Assume (map (lambda V1654 (shen-assumetype V1654)) Table)
42
- (trap-error
43
- (map (lambda V1655 (shen-typecheck-and-load V1655)) RemoveSynonyms)
44
- (lambda E (shen-unwind-types E Table)))))))))
63
+ (defun shen.typetable (V825) (cond ((and (cons? V825) (and (= define (hd V825)) (cons? (tl V825)))) (let Sig (compile shen.<sig+rest> (tl (tl V825)) ()) (if (= Sig (fail)) (simple-error (shen.app (hd (tl V825)) " lacks a proper signature.
64
+ " shen.a)) (cons (cons (hd (tl V825)) Sig) ())))) ((and (cons? V825) (and (= defcc (hd V825)) (and (cons? (tl V825)) (and (cons? (tl (tl V825))) (and (= { (hd (tl (tl V825)))) (and (cons? (tl (tl (tl V825)))) (and (cons? (hd (tl (tl (tl V825))))) (and (= list (hd (hd (tl (tl (tl V825)))))) (and (cons? (tl (hd (tl (tl (tl V825)))))) (and (= () (tl (tl (hd (tl (tl (tl V825))))))) (and (cons? (tl (tl (tl (tl V825))))) (and (= ==> (hd (tl (tl (tl (tl V825)))))) (and (cons? (tl (tl (tl (tl (tl V825)))))) (and (cons? (tl (tl (tl (tl (tl (tl V825))))))) (= } (hd (tl (tl (tl (tl (tl (tl V825)))))))))))))))))))))) (cons (cons (hd (tl V825)) (cons (hd (tl (tl (tl V825)))) (cons ==> (cons (hd (tl (tl (tl (tl (tl V825)))))) ())))) ())) ((and (cons? V825) (and (= defcc (hd V825)) (cons? (tl V825)))) (simple-error (shen.app (hd (tl V825)) " lacks a proper signature.
65
+ " shen.a))) (true ())))
45
66
 
46
- (defun shen-remove-synonyms (V1656)
47
- (cond
48
- ((and (cons? V1656) (= shen-synonyms-help (hd V1656)))
49
- (do (eval V1656) ()))
50
- (true (cons V1656 ()))))
67
+ (defun shen.assumetype (V826) (cond ((cons? V826) (declare (hd V826) (tl V826))) (true (shen.sys-error shen.assumetype))))
51
68
 
52
- (defun shen-typecheck-and-load (V1657)
53
- (do (nl 1) (shen-typecheck-and-evaluate V1657 (gensym A))))
69
+ (defun shen.unwind-types (V831 V832) (cond ((= () V832) (simple-error (error-to-string V831))) ((and (cons? V832) (cons? (hd V832))) (do (shen.remtype (hd (hd V832))) (shen.unwind-types V831 (tl V832)))) (true (shen.sys-error shen.unwind-types))))
54
70
 
55
- (defun shen-typetable (V1662)
56
- (cond
57
- ((and (cons? V1662) (and (= define (hd V1662)) (cons? (tl V1662))))
58
- (let Sig
59
- (compile (lambda V1663 (shen-<sig+rest> V1663)) (tl (tl V1662)) ())
60
- (if (= Sig (fail))
61
- (interror "~A lacks a proper signature.~%" (@p (hd (tl V1662)) ()))
62
- (cons (cons (hd (tl V1662)) Sig) ()))))
63
- (true ())))
71
+ (defun shen.remtype (V833) (do (set shen.*signedfuncs* (remove V833 (value shen.*signedfuncs*))) V833))
64
72
 
65
- (defun shen-assumetype (V1664)
66
- (cond ((cons? V1664) (declare (hd V1664) (tl V1664)))
67
- (true (shen-sys-error shen-assumetype))))
73
+ (defun shen.<sig+rest> (V838) (let Result (let Parse_shen.<signature> (shen.<signature> V838) (if (not (= (fail) Parse_shen.<signature>)) (let Parse_shen.<any> (shen.<any> Parse_shen.<signature>) (if (not (= (fail) Parse_shen.<any>)) (shen.pair (hd Parse_shen.<any>) (shen.hdtl Parse_shen.<signature>)) (fail))) (fail))) (if (= Result (fail)) (fail) Result)))
68
74
 
69
- (defun shen-unwind-types (V1669 V1670)
70
- (cond ((= () V1670) (simple-error (error-to-string V1669)))
71
- ((and (cons? V1670) (cons? (hd V1670)))
72
- (do (shen-remtype (hd (hd V1670))) (shen-unwind-types V1669 (tl V1670))))
73
- (true (shen-sys-error shen-unwind-types))))
75
+ (defun write-to-file (V839 V840) (let Stream (open file V839 out) (let String (if (string? V840) (shen.app V840 "
74
76
 
75
- (defun shen-remtype (V1671)
76
- (do (set shen-*signedfuncs* (remove V1671 (value shen-*signedfuncs*))) V1671))
77
+ " shen.a) (shen.app V840 "
78
+
79
+ " shen.s)) (let Write (pr String Stream) (let Close (close Stream) V840)))))
77
80
 
78
- (defun shen-<sig+rest> (V1672)
79
- (let Result
80
- (let Parse_<signature> (shen-<signature> V1672)
81
- (if (not (= (fail) Parse_<signature>))
82
- (let Parse_<any> (shen-<any> Parse_<signature>)
83
- (if (not (= (fail) Parse_<any>))
84
- (shen-reassemble (fst Parse_<any>) (snd Parse_<signature>)) (fail)))
85
- (fail)))
86
- (if (= Result (fail)) (fail) Result)))
87
81
 
88
- (defun write-to-file (V1673 V1674)
89
- (let Stream (open file V1673 out)
90
- (let String
91
- (if (string? V1674) (intmake-string "~A~%~%" (@p V1674 ()))
92
- (intmake-string "~S~%~%" (@p V1674 ())))
93
- (let Write (pr String Stream) (let Close (close Stream) V1674)))))
94
82
 
@@ -1,479 +1,114 @@
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 macroexpand (V841) (let Y (shen.compose (value *macros*) V841) (if (= V841 Y) V841 (shen.walk macroexpand Y))))
51
+
52
+ (set *macros* (cons shen.timer-macro (cons shen.cases-macro (cons shen.abs-macro (cons shen.put/get-macro (cons shen.compile-macro (cons shen.datatype-macro (cons shen.let-macro (cons shen.assoc-macro (cons shen.make-string-macro (cons shen.output-macro (cons shen.error-macro (cons shen.prolog-macro (cons shen.synonyms-macro (cons shen.nl-macro (cons shen.@s-macro (cons shen.defmacro-macro (cons shen.defprolog-macro (cons shen.function-macro ())))))))))))))))))))
53
+
54
+ (defun shen.error-macro (V842) (cond ((and (cons? V842) (and (= error (hd V842)) (cons? (tl V842)))) (cons simple-error (cons (shen.mkstr (hd (tl V842)) (tl (tl V842))) ()))) (true V842)))
55
+
56
+ (defun shen.output-macro (V843) (cond ((and (cons? V843) (and (= output (hd V843)) (cons? (tl V843)))) (cons pr (cons (shen.mkstr (hd (tl V843)) (tl (tl V843))) (cons (cons stoutput ()) ())))) (true V843)))
57
+
58
+ (defun shen.make-string-macro (V844) (cond ((and (cons? V844) (and (= make-string (hd V844)) (cons? (tl V844)))) (shen.mkstr (hd (tl V844)) (tl (tl V844)))) (true V844)))
59
+
60
+ (defun shen.compose (V845 V846) (cond ((= () V845) V846) ((cons? V845) (shen.compose (tl V845) ((hd V845) V846))) (true (shen.sys-error shen.compose))))
61
+
62
+ (defun shen.compile-macro (V847) (cond ((and (cons? V847) (and (= compile (hd V847)) (and (cons? (tl V847)) (and (cons? (tl (tl V847))) (= () (tl (tl (tl V847)))))))) (cons compile (cons (hd (tl V847)) (cons (hd (tl (tl V847))) (cons (cons lambda (cons E (cons (cons if (cons (cons cons? (cons E ())) (cons (cons error (cons "parse error here: ~S~%" (cons E ()))) (cons (cons error (cons "parse error~%" ())) ())))) ()))) ()))))) (true V847)))
63
+
64
+ (defun shen.prolog-macro (V848) (cond ((and (cons? V848) (= prolog? (hd V848))) (cons shen.intprolog (cons (shen.prolog-form (tl V848)) ()))) (true V848)))
65
+
66
+ (defun shen.defprolog-macro (V849) (cond ((and (cons? V849) (and (= defprolog (hd V849)) (cons? (tl V849)))) (compile shen.<defprolog> (tl V849) (lambda Y (shen.prolog-error (hd (tl V849)) Y)))) (true V849)))
67
+
68
+ (defun shen.prolog-form (V850) (shen.cons_form (map shen.cons_form V850)))
69
+
70
+ (defun shen.datatype-macro (V851) (cond ((and (cons? V851) (and (= datatype (hd V851)) (cons? (tl V851)))) (cons shen.process-datatype (cons (intern (cn "type#" (str (hd (tl V851))))) (cons (cons compile (cons (cons function (cons shen.<datatype-rules> ())) (cons (shen.rcons_form (tl (tl V851))) (cons (cons function (cons shen.datatype-error ())) ())))) ())))) (true V851)))
71
+
72
+ (defun shen.defmacro-macro (V852) (cond ((and (cons? V852) (and (= defmacro (hd V852)) (cons? (tl V852)))) (let Macro (cons define (cons (hd (tl V852)) (append (tl (tl V852)) (cons X (cons -> (cons X ())))))) (let Declare (cons do (cons (cons set (cons *macros* (cons (cons adjoin (cons (hd (tl V852)) (cons (cons value (cons *macros* ())) ()))) ()))) (cons macro ()))) (let Package (cons package (cons null (cons () (cons Declare (cons Macro ()))))) Package)))) (true V852)))
73
+
74
+ (defun shen.<defmacro> (V857) (let Result (let Parse_shen.<name> (shen.<name> V857) (if (not (= (fail) Parse_shen.<name>)) (let Parse_shen.<macrorules> (shen.<macrorules> Parse_shen.<name>) (if (not (= (fail) Parse_shen.<macrorules>)) (shen.pair (hd Parse_shen.<macrorules>) (cons define (cons (shen.hdtl Parse_shen.<name>) (shen.hdtl Parse_shen.<macrorules>)))) (fail))) (fail))) (if (= Result (fail)) (fail) Result)))
75
+
76
+ (defun shen.<macrorules> (V862) (let Result (let Parse_shen.<macrorule> (shen.<macrorule> V862) (if (not (= (fail) Parse_shen.<macrorule>)) (let Parse_shen.<macrorules> (shen.<macrorules> Parse_shen.<macrorule>) (if (not (= (fail) Parse_shen.<macrorules>)) (shen.pair (hd Parse_shen.<macrorules>) (append (shen.hdtl Parse_shen.<macrorule>) (append (shen.hdtl Parse_shen.<macrorules>) ()))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_shen.<macrorule> (shen.<macrorule> V862) (if (not (= (fail) Parse_shen.<macrorule>)) (shen.pair (hd Parse_shen.<macrorule>) (append (shen.hdtl Parse_shen.<macrorule>) (cons Parse_X (cons -> (cons Parse_X ()))))) (fail))) (if (= Result (fail)) (fail) Result)) Result)))
77
+
78
+ (defun shen.<macrorule> (V867) (let Result (let Parse_shen.<patterns> (shen.<patterns> V867) (if (not (= (fail) Parse_shen.<patterns>)) (if (and (cons? (hd Parse_shen.<patterns>)) (= -> (hd (hd Parse_shen.<patterns>)))) (let Parse_shen.<macroaction> (shen.<macroaction> (shen.pair (tl (hd Parse_shen.<patterns>)) (shen.hdtl Parse_shen.<patterns>))) (if (not (= (fail) Parse_shen.<macroaction>)) (if (and (cons? (hd Parse_shen.<macroaction>)) (= where (hd (hd Parse_shen.<macroaction>)))) (let Parse_shen.<guard> (shen.<guard> (shen.pair (tl (hd Parse_shen.<macroaction>)) (shen.hdtl Parse_shen.<macroaction>))) (if (not (= (fail) Parse_shen.<guard>)) (shen.pair (hd Parse_shen.<guard>) (append (shen.hdtl Parse_shen.<patterns>) (cons -> (append (shen.hdtl Parse_shen.<macroaction>) (cons where (append (shen.hdtl Parse_shen.<guard>) ())))))) (fail))) (fail)) (fail))) (fail)) (fail))) (if (= Result (fail)) (let Result (let Parse_shen.<patterns> (shen.<patterns> V867) (if (not (= (fail) Parse_shen.<patterns>)) (if (and (cons? (hd Parse_shen.<patterns>)) (= -> (hd (hd Parse_shen.<patterns>)))) (let Parse_shen.<macroaction> (shen.<macroaction> (shen.pair (tl (hd Parse_shen.<patterns>)) (shen.hdtl Parse_shen.<patterns>))) (if (not (= (fail) Parse_shen.<macroaction>)) (shen.pair (hd Parse_shen.<macroaction>) (append (shen.hdtl Parse_shen.<patterns>) (cons -> (append (shen.hdtl Parse_shen.<macroaction>) ())))) (fail))) (fail)) (fail))) (if (= Result (fail)) (let Result (let Parse_shen.<patterns> (shen.<patterns> V867) (if (not (= (fail) Parse_shen.<patterns>)) (if (and (cons? (hd Parse_shen.<patterns>)) (= <- (hd (hd Parse_shen.<patterns>)))) (let Parse_shen.<macroaction> (shen.<macroaction> (shen.pair (tl (hd Parse_shen.<patterns>)) (shen.hdtl Parse_shen.<patterns>))) (if (not (= (fail) Parse_shen.<macroaction>)) (if (and (cons? (hd Parse_shen.<macroaction>)) (= where (hd (hd Parse_shen.<macroaction>)))) (let Parse_shen.<guard> (shen.<guard> (shen.pair (tl (hd Parse_shen.<macroaction>)) (shen.hdtl Parse_shen.<macroaction>))) (if (not (= (fail) Parse_shen.<guard>)) (shen.pair (hd Parse_shen.<guard>) (append (shen.hdtl Parse_shen.<patterns>) (cons <- (append (shen.hdtl Parse_shen.<macroaction>) (cons where (append (shen.hdtl Parse_shen.<guard>) ())))))) (fail))) (fail)) (fail))) (fail)) (fail))) (if (= Result (fail)) (let Result (let Parse_shen.<patterns> (shen.<patterns> V867) (if (not (= (fail) Parse_shen.<patterns>)) (if (and (cons? (hd Parse_shen.<patterns>)) (= <- (hd (hd Parse_shen.<patterns>)))) (let Parse_shen.<macroaction> (shen.<macroaction> (shen.pair (tl (hd Parse_shen.<patterns>)) (shen.hdtl Parse_shen.<patterns>))) (if (not (= (fail) Parse_shen.<macroaction>)) (shen.pair (hd Parse_shen.<macroaction>) (append (shen.hdtl Parse_shen.<patterns>) (cons <- (append (shen.hdtl Parse_shen.<macroaction>) ())))) (fail))) (fail)) (fail))) (if (= Result (fail)) (fail) Result)) Result)) Result)) Result)))
79
+
80
+ (defun shen.<macroaction> (V872) (let Result (let Parse_shen.<action> (shen.<action> V872) (if (not (= (fail) Parse_shen.<action>)) (shen.pair (hd Parse_shen.<action>) (cons (cons shen.walk (cons (cons function (cons macroexpand ())) (cons (shen.hdtl Parse_shen.<action>) ()))) ())) (fail))) (if (= Result (fail)) (fail) Result)))
81
+
82
+ (defun shen.@s-macro (V873) (cond ((and (cons? V873) (and (= @s (hd V873)) (and (cons? (tl V873)) (and (cons? (tl (tl V873))) (cons? (tl (tl (tl V873)))))))) (cons @s (cons (hd (tl V873)) (cons (shen.@s-macro (cons @s (tl (tl V873)))) ())))) ((and (cons? V873) (and (= @s (hd V873)) (and (cons? (tl V873)) (and (cons? (tl (tl V873))) (and (= () (tl (tl (tl V873)))) (string? (hd (tl V873)))))))) (let E (explode (hd (tl V873))) (if (> (length E) 1) (shen.@s-macro (cons @s (append E (tl (tl V873))))) V873))) (true V873)))
83
+
84
+ (defun shen.synonyms-macro (V874) (cond ((and (cons? V874) (= synonyms (hd V874))) (cons shen.synonyms-help (cons (shen.rcons_form (tl V874)) ()))) (true V874)))
85
+
86
+ (defun shen.nl-macro (V875) (cond ((and (cons? V875) (and (= nl (hd V875)) (= () (tl V875)))) (cons nl (cons 1 ()))) (true V875)))
87
+
88
+ (defun shen.assoc-macro (V876) (cond ((and (cons? V876) (and (cons? (tl V876)) (and (cons? (tl (tl V876))) (and (cons? (tl (tl (tl V876)))) (element? (hd V876) (cons @p (cons @v (cons append (cons and (cons or (cons + (cons * (cons do ()))))))))))))) (cons (hd V876) (cons (hd (tl V876)) (cons (shen.assoc-macro (cons (hd V876) (tl (tl V876)))) ())))) (true V876)))
89
+
90
+ (defun shen.let-macro (V877) (cond ((and (cons? V877) (and (= let (hd V877)) (and (cons? (tl V877)) (and (cons? (tl (tl V877))) (and (cons? (tl (tl (tl V877)))) (cons? (tl (tl (tl (tl V877)))))))))) (cons let (cons (hd (tl V877)) (cons (hd (tl (tl V877))) (cons (shen.let-macro (cons let (tl (tl (tl V877))))) ()))))) (true V877)))
91
+
92
+ (defun shen.abs-macro (V878) (cond ((and (cons? V878) (and (= /. (hd V878)) (and (cons? (tl V878)) (and (cons? (tl (tl V878))) (cons? (tl (tl (tl V878)))))))) (cons lambda (cons (hd (tl V878)) (cons (shen.abs-macro (cons /. (tl (tl V878)))) ())))) ((and (cons? V878) (and (= /. (hd V878)) (and (cons? (tl V878)) (and (cons? (tl (tl V878))) (= () (tl (tl (tl V878)))))))) (cons lambda (tl V878))) (true V878)))
93
+
94
+ (defun shen.cases-macro (V881) (cond ((and (cons? V881) (and (= cases (hd V881)) (and (cons? (tl V881)) (and (= true (hd (tl V881))) (cons? (tl (tl V881))))))) (hd (tl (tl V881)))) ((and (cons? V881) (and (= cases (hd V881)) (and (cons? (tl V881)) (and (cons? (tl (tl V881))) (= () (tl (tl (tl V881)))))))) (cons if (cons (hd (tl V881)) (cons (hd (tl (tl V881))) (cons (cons simple-error (cons "error: cases exhausted" ())) ()))))) ((and (cons? V881) (and (= cases (hd V881)) (and (cons? (tl V881)) (cons? (tl (tl V881)))))) (cons if (cons (hd (tl V881)) (cons (hd (tl (tl V881))) (cons (shen.cases-macro (cons cases (tl (tl (tl V881))))) ()))))) ((and (cons? V881) (and (= cases (hd V881)) (and (cons? (tl V881)) (= () (tl (tl V881)))))) (simple-error "error: odd number of case elements
95
+ ")) (true V881)))
96
+
97
+ (defun shen.timer-macro (V882) (cond ((and (cons? V882) (and (= time (hd V882)) (and (cons? (tl V882)) (= () (tl (tl V882)))))) (shen.let-macro (cons let (cons Start (cons (cons get-time (cons run ())) (cons Result (cons (hd (tl V882)) (cons Finish (cons (cons get-time (cons run ())) (cons Time (cons (cons - (cons Finish (cons Start ()))) (cons Message (cons (cons pr (cons (cons cn (cons "
98
+ run time: " (cons (cons cn (cons (cons str (cons Time ())) (cons " secs
99
+ " ()))) ()))) (cons (cons stoutput ()) ()))) (cons Result ())))))))))))))) (true V882)))
100
+
101
+ (defun shen.tuple-up (V883) (cond ((cons? V883) (cons @p (cons (hd V883) (cons (shen.tuple-up (tl V883)) ())))) (true V883)))
102
+
103
+ (defun shen.put/get-macro (V884) (cond ((and (cons? V884) (and (= put (hd V884)) (and (cons? (tl V884)) (and (cons? (tl (tl V884))) (and (cons? (tl (tl (tl V884)))) (= () (tl (tl (tl (tl V884)))))))))) (cons put (cons (hd (tl V884)) (cons (hd (tl (tl V884))) (cons (hd (tl (tl (tl V884)))) (cons (cons value (cons *property-vector* ())) ())))))) ((and (cons? V884) (and (= get (hd V884)) (and (cons? (tl V884)) (and (cons? (tl (tl V884))) (= () (tl (tl (tl V884)))))))) (cons get (cons (hd (tl V884)) (cons (hd (tl (tl V884))) (cons (cons value (cons *property-vector* ())) ()))))) (true V884)))
104
+
105
+ (defun shen.function-macro (V885) (cond ((and (cons? V885) (and (= function (hd V885)) (and (cons? (tl V885)) (= () (tl (tl V885)))))) (shen.function-abstraction (hd (tl V885)) (arity (hd (tl V885))))) (true V885)))
106
+
107
+ (defun shen.function-abstraction (V886 V887) (cond ((= 0 V887) (cons freeze (cons V886 ()))) ((= -1 V887) V886) (true (shen.function-abstraction-help V886 V887 ()))))
108
+
109
+ (defun shen.function-abstraction-help (V888 V889 V890) (cond ((= 0 V889) (cons V888 V890)) (true (let X (gensym V) (cons /. (cons X (cons (shen.function-abstraction-help V888 (- V889 1) (append V890 (cons X ()))) ())))))))
110
+
111
+ (defun undefmacro (V891) (do (set *macros* (remove V891 (value *macros*))) V891))
112
+
113
+
1
114
 
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 macroexpand (V530) (shen-compose (value *macros*) V530))
19
-
20
- (defun macroexpand (V531)
21
- (let Y (shen-compose (value *macros*) V531)
22
- (if (= V531 Y) V531 (shen-walk macroexpand Y))))
23
-
24
- (set *macros*
25
- (cons shen-timer-macro
26
- (cons shen-cases-macro
27
- (cons shen-abs-macro
28
- (cons shen-put/get-macro
29
- (cons shen-compile-macro
30
- (cons shen-yacc-macro
31
- (cons shen-datatype-macro
32
- (cons shen-let-macro
33
- (cons shen-assoc-macro
34
- (cons shen-i/o-macro
35
- (cons shen-prolog-macro
36
- (cons shen-synonyms-macro
37
- (cons shen-nl-macro
38
- (cons shen-vector-macro
39
- (cons shen-@s-macro
40
- (cons shen-defmacro-macro
41
- (cons shen-defprolog-macro
42
- (cons shen-function-macro ())))))))))))))))))))
43
-
44
- (defun shen-compose (V532 V533)
45
- (cond ((= () V532) V533)
46
- ((cons? V532) (shen-compose (tl V532) ((hd V532) V533)))
47
- (true (shen-sys-error shen-compose))))
48
-
49
- (defun shen-compile-macro (V534)
50
- (cond
51
- ((and (cons? V534)
52
- (and (= compile (hd V534))
53
- (and (cons? (tl V534))
54
- (and (cons? (tl (tl V534))) (= () (tl (tl (tl V534))))))))
55
- (cons compile
56
- (cons (hd (tl V534)) (cons (hd (tl (tl V534))) (cons () ())))))
57
- (true V534)))
58
-
59
- (defun shen-prolog-macro (V535)
60
- (cond
61
- ((and (cons? V535) (= prolog? (hd V535)))
62
- (cons shen-intprolog (cons (shen-prolog-form (tl V535)) ())))
63
- (true V535)))
64
-
65
- (defun shen-defprolog-macro (V536)
66
- (cond
67
- ((and (cons? V536) (and (= defprolog (hd V536)) (cons? (tl V536))))
68
- (compile (lambda V537 (shen-<defprolog> V537)) (tl V536)
69
- (lambda Y (shen-prolog-error (hd (tl V536)) Y))))
70
- (true V536)))
71
-
72
- (defun shen-prolog-form (V538)
73
- (shen-cons_form (map (lambda V539 (shen-cons_form V539)) V538)))
74
-
75
- (defun shen-datatype-macro (V540)
76
- (cond
77
- ((and (cons? V540) (and (= datatype (hd V540)) (cons? (tl V540))))
78
- (cons shen-process-datatype
79
- (cons (hd (tl V540))
80
- (cons
81
- (cons compile
82
- (cons (cons function (cons shen-<datatype-rules> ()))
83
- (cons (shen-rcons_form (tl (tl V540)))
84
- (cons (cons function (cons shen-datatype-error ())) ()))))
85
- ()))))
86
- (true V540)))
87
-
88
- (defun shen-defmacro-macro (V541)
89
- (cond
90
- ((and (cons? V541) (and (= defmacro (hd V541)) (cons? (tl V541))))
91
- (let Macro (compile shen-<defmacro> (tl V541) ())
92
- (let Declare
93
- (cons do
94
- (cons
95
- (cons set
96
- (cons *macros*
97
- (cons
98
- (cons adjoin
99
- (cons (hd (tl V541)) (cons (cons value (cons *macros* ())) ())))
100
- ())))
101
- (cons macro ())))
102
- (let Package
103
- (cons package (cons null (cons () (cons Declare (cons Macro ())))))
104
- Package))))
105
- (true V541)))
106
-
107
- (defun shen-defmacro-macro (V542)
108
- (cond
109
- ((and (cons? V542) (and (= defmacro (hd V542)) (cons? (tl V542))))
110
- (let Macro
111
- (cons define
112
- (cons (hd (tl V542))
113
- (append (tl (tl V542)) (cons X (cons -> (cons X ()))))))
114
- (let Declare
115
- (cons do
116
- (cons
117
- (cons set
118
- (cons *macros*
119
- (cons
120
- (cons adjoin
121
- (cons (hd (tl V542)) (cons (cons value (cons *macros* ())) ())))
122
- ())))
123
- (cons macro ())))
124
- (let Package
125
- (cons package (cons null (cons () (cons Declare (cons Macro ())))))
126
- Package))))
127
- (true V542)))
128
-
129
- (defun shen-<defmacro> (V543)
130
- (let Result
131
- (let Parse_<name> (shen-<name> V543)
132
- (if (not (= (fail) Parse_<name>))
133
- (let Parse_<macrorules> (shen-<macrorules> Parse_<name>)
134
- (if (not (= (fail) Parse_<macrorules>))
135
- (shen-reassemble (fst Parse_<macrorules>)
136
- (cons define (cons (snd Parse_<name>) (snd Parse_<macrorules>))))
137
- (fail)))
138
- (fail)))
139
- (if (= Result (fail)) (fail) Result)))
140
-
141
- (defun shen-<macrorules> (V544)
142
- (let Result
143
- (let Parse_<macrorule> (shen-<macrorule> V544)
144
- (if (not (= (fail) Parse_<macrorule>))
145
- (let Parse_<macrorules> (shen-<macrorules> Parse_<macrorule>)
146
- (if (not (= (fail) Parse_<macrorules>))
147
- (shen-reassemble (fst Parse_<macrorules>)
148
- (append (snd Parse_<macrorule>) (snd Parse_<macrorules>)))
149
- (fail)))
150
- (fail)))
151
- (if (= Result (fail))
152
- (let Result
153
- (let Parse_<macrorule> (shen-<macrorule> V544)
154
- (if (not (= (fail) Parse_<macrorule>))
155
- (shen-reassemble (fst Parse_<macrorule>)
156
- (append (snd Parse_<macrorule>) (cons X (cons -> (cons X ())))))
157
- (fail)))
158
- (if (= Result (fail)) (fail) Result))
159
- Result)))
160
-
161
- (defun shen-<macrorule> (V545)
162
- (let Result
163
- (let Parse_<patterns> (shen-<patterns> V545)
164
- (if (not (= (fail) Parse_<patterns>))
165
- (if
166
- (and (cons? (fst Parse_<patterns>)) (= -> (hd (fst Parse_<patterns>))))
167
- (let Parse_<macroaction>
168
- (shen-<macroaction>
169
- (shen-reassemble (tl (fst Parse_<patterns>)) (snd Parse_<patterns>)))
170
- (if (not (= (fail) Parse_<macroaction>))
171
- (if
172
- (and (cons? (fst Parse_<macroaction>))
173
- (= where (hd (fst Parse_<macroaction>))))
174
- (let Parse_<guard>
175
- (shen-<guard>
176
- (shen-reassemble (tl (fst Parse_<macroaction>))
177
- (snd Parse_<macroaction>)))
178
- (if (not (= (fail) Parse_<guard>))
179
- (shen-reassemble (fst Parse_<guard>)
180
- (append (snd Parse_<patterns>)
181
- (cons ->
182
- (append (snd Parse_<macroaction>)
183
- (cons where (snd Parse_<guard>))))))
184
- (fail)))
185
- (fail))
186
- (fail)))
187
- (fail))
188
- (fail)))
189
- (if (= Result (fail))
190
- (let Result
191
- (let Parse_<patterns> (shen-<patterns> V545)
192
- (if (not (= (fail) Parse_<patterns>))
193
- (if
194
- (and (cons? (fst Parse_<patterns>))
195
- (= -> (hd (fst Parse_<patterns>))))
196
- (let Parse_<macroaction>
197
- (shen-<macroaction>
198
- (shen-reassemble (tl (fst Parse_<patterns>)) (snd Parse_<patterns>)))
199
- (if (not (= (fail) Parse_<macroaction>))
200
- (shen-reassemble (fst Parse_<macroaction>)
201
- (append (snd Parse_<patterns>) (cons -> (snd Parse_<macroaction>))))
202
- (fail)))
203
- (fail))
204
- (fail)))
205
- (if (= Result (fail))
206
- (let Result
207
- (let Parse_<patterns> (shen-<patterns> V545)
208
- (if (not (= (fail) Parse_<patterns>))
209
- (if
210
- (and (cons? (fst Parse_<patterns>))
211
- (= <- (hd (fst Parse_<patterns>))))
212
- (let Parse_<macroaction>
213
- (shen-<macroaction>
214
- (shen-reassemble (tl (fst Parse_<patterns>))
215
- (snd Parse_<patterns>)))
216
- (if (not (= (fail) Parse_<macroaction>))
217
- (if
218
- (and (cons? (fst Parse_<macroaction>))
219
- (= where (hd (fst Parse_<macroaction>))))
220
- (let Parse_<guard>
221
- (shen-<guard>
222
- (shen-reassemble (tl (fst Parse_<macroaction>))
223
- (snd Parse_<macroaction>)))
224
- (if (not (= (fail) Parse_<guard>))
225
- (shen-reassemble (fst Parse_<guard>)
226
- (append (snd Parse_<patterns>)
227
- (cons <-
228
- (append (snd Parse_<macroaction>)
229
- (cons where (snd Parse_<guard>))))))
230
- (fail)))
231
- (fail))
232
- (fail)))
233
- (fail))
234
- (fail)))
235
- (if (= Result (fail))
236
- (let Result
237
- (let Parse_<patterns> (shen-<patterns> V545)
238
- (if (not (= (fail) Parse_<patterns>))
239
- (if
240
- (and (cons? (fst Parse_<patterns>))
241
- (= <- (hd (fst Parse_<patterns>))))
242
- (let Parse_<macroaction>
243
- (shen-<macroaction>
244
- (shen-reassemble (tl (fst Parse_<patterns>))
245
- (snd Parse_<patterns>)))
246
- (if (not (= (fail) Parse_<macroaction>))
247
- (shen-reassemble (fst Parse_<macroaction>)
248
- (append (snd Parse_<patterns>)
249
- (cons <- (snd Parse_<macroaction>))))
250
- (fail)))
251
- (fail))
252
- (fail)))
253
- (if (= Result (fail)) (fail) Result))
254
- Result))
255
- Result))
256
- Result)))
257
-
258
- (defun shen-<macroaction> (V546)
259
- (let Result
260
- (let Parse_<action> (shen-<action> V546)
261
- (if (not (= (fail) Parse_<action>))
262
- (shen-reassemble (fst Parse_<action>)
263
- (cons
264
- (cons shen-walk
265
- (cons (cons function (cons macroexpand ()))
266
- (cons (snd Parse_<action>) ())))
267
- ()))
268
- (fail)))
269
- (if (= Result (fail)) (fail) Result)))
270
-
271
- (defun shen-@s-macro (V547)
272
- (cond
273
- ((and (cons? V547)
274
- (and (= @s (hd V547))
275
- (and (cons? (tl V547))
276
- (and (cons? (tl (tl V547))) (cons? (tl (tl (tl V547))))))))
277
- (cons @s
278
- (cons (hd (tl V547)) (cons (shen-@s-macro (cons @s (tl (tl V547)))) ()))))
279
- ((and (cons? V547)
280
- (and (= @s (hd V547))
281
- (and (cons? (tl V547))
282
- (and (cons? (tl (tl V547)))
283
- (and (= () (tl (tl (tl V547)))) (string? (hd (tl V547))))))))
284
- (let E (explode (hd (tl V547)))
285
- (if (> (length E) 1) (shen-@s-macro (cons @s (append E (tl (tl V547)))))
286
- V547)))
287
- (true V547)))
288
-
289
- (defun shen-synonyms-macro (V548)
290
- (cond
291
- ((and (cons? V548) (= synonyms (hd V548)))
292
- (cons shen-synonyms-help (cons (shen-rcons_form (tl V548)) ())))
293
- (true V548)))
294
-
295
- (defun shen-nl-macro (V549)
296
- (cond
297
- ((and (cons? V549) (and (= nl (hd V549)) (= () (tl V549))))
298
- (cons nl (cons 1 ())))
299
- (true V549)))
300
-
301
- (defun shen-vector-macro (V550)
302
- (cond ((= <> V550) (cons vector (cons 0 ()))) (true V550)))
303
-
304
- (defun shen-yacc-macro (V551)
305
- (cond
306
- ((and (cons? V551) (and (= defcc (hd V551)) (cons? (tl V551))))
307
- (shen-yacc->shen (hd (tl V551)) (tl (tl V551))
308
- (shen-extract-segvars (tl (tl V551)))))
309
- (true V551)))
310
-
311
- (defun shen-assoc-macro (V552)
312
- (cond
313
- ((and (cons? V552)
314
- (and (cons? (tl V552))
315
- (and (cons? (tl (tl V552)))
316
- (and (cons? (tl (tl (tl V552))))
317
- (element? (hd V552)
318
- (cons @p
319
- (cons @v
320
- (cons append
321
- (cons and (cons or (cons + (cons * (cons do ())))))))))))))
322
- (cons (hd V552)
323
- (cons (hd (tl V552))
324
- (cons (shen-assoc-macro (cons (hd V552) (tl (tl V552)))) ()))))
325
- (true V552)))
326
-
327
- (defun shen-let-macro (V553)
328
- (cond
329
- ((and (cons? V553)
330
- (and (= let (hd V553))
331
- (and (cons? (tl V553))
332
- (and (cons? (tl (tl V553)))
333
- (and (cons? (tl (tl (tl V553)))) (cons? (tl (tl (tl (tl V553))))))))))
334
- (cons let
335
- (cons (hd (tl V553))
336
- (cons (hd (tl (tl V553)))
337
- (cons (shen-let-macro (cons let (tl (tl (tl V553))))) ())))))
338
- (true V553)))
339
-
340
- (defun shen-abs-macro (V554)
341
- (cond
342
- ((and (cons? V554)
343
- (and (= /. (hd V554))
344
- (and (cons? (tl V554))
345
- (and (cons? (tl (tl V554))) (cons? (tl (tl (tl V554))))))))
346
- (cons lambda
347
- (cons (hd (tl V554))
348
- (cons (shen-abs-macro (cons /. (tl (tl V554)))) ()))))
349
- ((and (cons? V554)
350
- (and (= /. (hd V554))
351
- (and (cons? (tl V554))
352
- (and (cons? (tl (tl V554))) (= () (tl (tl (tl V554))))))))
353
- (cons lambda (tl V554)))
354
- (true V554)))
355
-
356
- (defun shen-cases-macro (V557)
357
- (cond
358
- ((and (cons? V557)
359
- (and (= cases (hd V557))
360
- (and (cons? (tl V557))
361
- (and (= true (hd (tl V557))) (cons? (tl (tl V557)))))))
362
- (hd (tl (tl V557))))
363
- ((and (cons? V557)
364
- (and (= cases (hd V557))
365
- (and (cons? (tl V557))
366
- (and (cons? (tl (tl V557))) (= () (tl (tl (tl V557))))))))
367
- (cons if
368
- (cons (hd (tl V557))
369
- (cons (hd (tl (tl V557)))
370
- (cons (shen-i/o-macro (cons error (cons "error: cases exhausted~%" ())))
371
- ())))))
372
- ((and (cons? V557)
373
- (and (= cases (hd V557))
374
- (and (cons? (tl V557)) (cons? (tl (tl V557))))))
375
- (cons if
376
- (cons (hd (tl V557))
377
- (cons (hd (tl (tl V557)))
378
- (cons (shen-cases-macro (cons cases (tl (tl (tl V557))))) ())))))
379
- ((and (cons? V557)
380
- (and (= cases (hd V557))
381
- (and (cons? (tl V557)) (= () (tl (tl V557))))))
382
- (interror "error: odd number of case elements~%" ()))
383
- (true V557)))
384
-
385
- (defun shen-timer-macro (V558)
386
- (cond
387
- ((and (cons? V558)
388
- (and (= time (hd V558))
389
- (and (cons? (tl V558)) (= () (tl (tl V558))))))
390
- (shen-let-macro
391
- (cons let
392
- (cons Start
393
- (cons (cons get-time (cons run ()))
394
- (cons Result
395
- (cons (hd (tl V558))
396
- (cons Finish
397
- (cons (cons get-time (cons run ()))
398
- (cons Time
399
- (cons (cons - (cons Finish (cons Start ())))
400
- (cons Message
401
- (cons
402
- (shen-i/o-macro
403
- (cons output (cons "~%run time: ~A secs~%" (cons Time ()))))
404
- (cons Result ()))))))))))))))
405
- (true V558)))
406
-
407
- (defun shen-i/o-macro (V559)
408
- (cond
409
- ((and (cons? V559) (and (= output (hd V559)) (cons? (tl V559))))
410
- (cons intoutput
411
- (cons (hd (tl V559)) (cons (shen-tuple-up (tl (tl V559))) ()))))
412
- ((and (cons? V559) (and (= make-string (hd V559)) (cons? (tl V559))))
413
- (cons intmake-string
414
- (cons (hd (tl V559)) (cons (shen-tuple-up (tl (tl V559))) ()))))
415
- ((and (cons? V559) (and (= error (hd V559)) (cons? (tl V559))))
416
- (cons interror
417
- (cons (hd (tl V559)) (cons (shen-tuple-up (tl (tl V559))) ()))))
418
- ((and (cons? V559)
419
- (and (= pr (hd V559))
420
- (and (cons? (tl V559)) (= () (tl (tl V559))))))
421
- (cons pr
422
- (cons (hd (tl V559)) (cons (cons shen-stoutput (cons 0 ())) ()))))
423
- ((and (cons? V559) (and (= read-byte (hd V559)) (= () (tl V559))))
424
- (cons read-byte (cons (cons stinput (cons 0 ())) ())))
425
- (true V559)))
426
-
427
- (defun shen-tuple-up (V560)
428
- (cond
429
- ((cons? V560)
430
- (cons @p (cons (hd V560) (cons (shen-tuple-up (tl V560)) ()))))
431
- (true V560)))
432
-
433
- (defun shen-put/get-macro (V561)
434
- (cond
435
- ((and (cons? V561)
436
- (and (= put (hd V561))
437
- (and (cons? (tl V561))
438
- (and (cons? (tl (tl V561)))
439
- (and (cons? (tl (tl (tl V561))))
440
- (= () (tl (tl (tl (tl V561))))))))))
441
- (cons put
442
- (cons (hd (tl V561))
443
- (cons (hd (tl (tl V561)))
444
- (cons (hd (tl (tl (tl V561))))
445
- (cons (cons value (cons shen-*property-vector* ())) ()))))))
446
- ((and (cons? V561)
447
- (and (= get (hd V561))
448
- (and (cons? (tl V561))
449
- (and (cons? (tl (tl V561))) (= () (tl (tl (tl V561))))))))
450
- (cons get
451
- (cons (hd (tl V561))
452
- (cons (hd (tl (tl V561)))
453
- (cons (cons value (cons shen-*property-vector* ())) ())))))
454
- (true V561)))
455
-
456
- (defun shen-function-macro (V562)
457
- (cond
458
- ((and (cons? V562)
459
- (and (= function (hd V562))
460
- (and (cons? (tl V562)) (= () (tl (tl V562))))))
461
- (shen-function-abstraction (hd (tl V562)) (arity (hd (tl V562)))))
462
- (true V562)))
463
-
464
- (defun shen-function-abstraction (V563 V564)
465
- (cond ((= 0 V564) (cons freeze (cons V563 ()))) ((= -1 V564) V563)
466
- (true (shen-function-abstraction-help V563 V564 ()))))
467
-
468
- (defun shen-function-abstraction-help (V565 V566 V567)
469
- (cond ((= 0 V566) (cons V565 V567))
470
- (true
471
- (let X (gensym V)
472
- (cons /.
473
- (cons X
474
- (cons
475
- (shen-function-abstraction-help V565 (- V566 1)
476
- (append V567 (cons X ())))
477
- ())))))))
478
-
479
- (defun undefmacro (F) (do (set *macros* (remove F (value *macros*))) F))