shen-ruby 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +4 -0
- data/README.md +8 -8
- data/lib/shen_ruby/version.rb +1 -1
- data/shen-ruby.gemspec +1 -1
- data/shen/release/benchmarks/jnk.shen +194 -0
- data/shen/release/k_lambda/declarations.kl +3 -3
- data/shen/release/k_lambda/macros.kl +0 -16
- data/shen/release/k_lambda/prolog.kl +1 -1
- data/shen/release/k_lambda/reader.kl +89 -79
- data/shen/release/k_lambda/sequent.kl +55 -55
- data/shen/release/k_lambda/sys.kl +98 -98
- data/shen/release/k_lambda/t-star.kl +37 -72
- data/shen/release/k_lambda/toplevel.kl +21 -21
- data/shen/release/k_lambda/track.kl +25 -25
- data/shen/release/k_lambda/types.kl +13 -5
- data/shen/release/k_lambda/writer.kl +25 -25
- data/shen/release/k_lambda/yacc.kl +28 -28
- data/shen/release/test_programs/einstein.shen +3 -2
- data/shen/release/test_programs/qmachine.shen +3 -3
- metadata +4 -3
@@ -47,118 +47,118 @@
|
|
47
47
|
* explains this license in full. *
|
48
48
|
* *
|
49
49
|
*****************************************************************************************
|
50
|
-
"(defun shen.datatype-error (
|
50
|
+
"(defun shen.datatype-error (V1686) (cond ((and (cons? V1686) (and (cons? (tl V1686)) (= () (tl (tl V1686))))) (simple-error (cn "datatype syntax error here:
|
51
51
|
|
52
|
-
" (shen.app (shen.next-50 50 (hd
|
52
|
+
" (shen.app (shen.next-50 50 (hd V1686)) "
|
53
53
|
" shen.a)))) (true (shen.sys-error shen.datatype-error))))
|
54
54
|
|
55
|
-
(defun shen.<datatype-rules> (
|
55
|
+
(defun shen.<datatype-rules> (V1691) (let Result (let Parse_shen.<datatype-rule> (shen.<datatype-rule> V1691) (if (not (= (fail) Parse_shen.<datatype-rule>)) (let Parse_shen.<datatype-rules> (shen.<datatype-rules> Parse_shen.<datatype-rule>) (if (not (= (fail) Parse_shen.<datatype-rules>)) (shen.pair (hd Parse_shen.<datatype-rules>) (cons (shen.hdtl Parse_shen.<datatype-rule>) (shen.hdtl Parse_shen.<datatype-rules>))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_<e> (<e> V1691) (if (not (= (fail) Parse_<e>)) (shen.pair (hd Parse_<e>) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result)))
|
56
56
|
|
57
|
-
(defun shen.<datatype-rule> (
|
57
|
+
(defun shen.<datatype-rule> (V1696) (let Result (let Parse_shen.<side-conditions> (shen.<side-conditions> V1696) (if (not (= (fail) Parse_shen.<side-conditions>)) (let Parse_shen.<premises> (shen.<premises> Parse_shen.<side-conditions>) (if (not (= (fail) Parse_shen.<premises>)) (let Parse_shen.<singleunderline> (shen.<singleunderline> Parse_shen.<premises>) (if (not (= (fail) Parse_shen.<singleunderline>)) (let Parse_shen.<conclusion> (shen.<conclusion> Parse_shen.<singleunderline>) (if (not (= (fail) Parse_shen.<conclusion>)) (shen.pair (hd Parse_shen.<conclusion>) (shen.sequent shen.single (cons (shen.hdtl Parse_shen.<side-conditions>) (cons (shen.hdtl Parse_shen.<premises>) (cons (shen.hdtl Parse_shen.<conclusion>) ()))))) (fail))) (fail))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_shen.<side-conditions> (shen.<side-conditions> V1696) (if (not (= (fail) Parse_shen.<side-conditions>)) (let Parse_shen.<premises> (shen.<premises> Parse_shen.<side-conditions>) (if (not (= (fail) Parse_shen.<premises>)) (let Parse_shen.<doubleunderline> (shen.<doubleunderline> Parse_shen.<premises>) (if (not (= (fail) Parse_shen.<doubleunderline>)) (let Parse_shen.<conclusion> (shen.<conclusion> Parse_shen.<doubleunderline>) (if (not (= (fail) Parse_shen.<conclusion>)) (shen.pair (hd Parse_shen.<conclusion>) (shen.sequent shen.double (cons (shen.hdtl Parse_shen.<side-conditions>) (cons (shen.hdtl Parse_shen.<premises>) (cons (shen.hdtl Parse_shen.<conclusion>) ()))))) (fail))) (fail))) (fail))) (fail))) (if (= Result (fail)) (fail) Result)) Result)))
|
58
58
|
|
59
|
-
(defun shen.<side-conditions> (
|
59
|
+
(defun shen.<side-conditions> (V1701) (let Result (let Parse_shen.<side-condition> (shen.<side-condition> V1701) (if (not (= (fail) Parse_shen.<side-condition>)) (let Parse_shen.<side-conditions> (shen.<side-conditions> Parse_shen.<side-condition>) (if (not (= (fail) Parse_shen.<side-conditions>)) (shen.pair (hd Parse_shen.<side-conditions>) (cons (shen.hdtl Parse_shen.<side-condition>) (shen.hdtl Parse_shen.<side-conditions>))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_<e> (<e> V1701) (if (not (= (fail) Parse_<e>)) (shen.pair (hd Parse_<e>) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result)))
|
60
60
|
|
61
|
-
(defun shen.<side-condition> (
|
61
|
+
(defun shen.<side-condition> (V1706) (let Result (if (and (cons? (hd V1706)) (= if (hd (hd V1706)))) (let Parse_shen.<expr> (shen.<expr> (shen.pair (tl (hd V1706)) (shen.hdtl V1706))) (if (not (= (fail) Parse_shen.<expr>)) (shen.pair (hd Parse_shen.<expr>) (cons if (cons (shen.hdtl Parse_shen.<expr>) ()))) (fail))) (fail)) (if (= Result (fail)) (let Result (if (and (cons? (hd V1706)) (= let (hd (hd V1706)))) (let Parse_shen.<variable?> (shen.<variable?> (shen.pair (tl (hd V1706)) (shen.hdtl V1706))) (if (not (= (fail) Parse_shen.<variable?>)) (let Parse_shen.<expr> (shen.<expr> Parse_shen.<variable?>) (if (not (= (fail) Parse_shen.<expr>)) (shen.pair (hd Parse_shen.<expr>) (cons let (cons (shen.hdtl Parse_shen.<variable?>) (cons (shen.hdtl Parse_shen.<expr>) ())))) (fail))) (fail))) (fail)) (if (= Result (fail)) (fail) Result)) Result)))
|
62
62
|
|
63
|
-
(defun shen.<variable?> (
|
63
|
+
(defun shen.<variable?> (V1711) (let Result (if (cons? (hd V1711)) (let Parse_X (hd (hd V1711)) (if (variable? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1711)) (shen.hdtl V1711))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
64
64
|
|
65
|
-
(defun shen.<expr> (
|
65
|
+
(defun shen.<expr> (V1716) (let Result (if (cons? (hd V1716)) (let Parse_X (hd (hd V1716)) (if (not (or (element? Parse_X (cons >> (cons ; ()))) (or (shen.singleunderline? Parse_X) (shen.doubleunderline? Parse_X)))) (shen.pair (hd (shen.pair (tl (hd V1716)) (shen.hdtl V1716))) (shen.remove-bar Parse_X)) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
66
66
|
|
67
|
-
(defun shen.remove-bar (
|
67
|
+
(defun shen.remove-bar (V1717) (cond ((and (cons? V1717) (and (cons? (tl V1717)) (and (cons? (tl (tl V1717))) (and (= () (tl (tl (tl V1717)))) (= (hd (tl V1717)) bar!))))) (cons (hd V1717) (hd (tl (tl V1717))))) ((cons? V1717) (cons (shen.remove-bar (hd V1717)) (shen.remove-bar (tl V1717)))) (true V1717)))
|
68
68
|
|
69
|
-
(defun shen.<premises> (
|
69
|
+
(defun shen.<premises> (V1722) (let Result (let Parse_shen.<premise> (shen.<premise> V1722) (if (not (= (fail) Parse_shen.<premise>)) (let Parse_shen.<semicolon-symbol> (shen.<semicolon-symbol> Parse_shen.<premise>) (if (not (= (fail) Parse_shen.<semicolon-symbol>)) (let Parse_shen.<premises> (shen.<premises> Parse_shen.<semicolon-symbol>) (if (not (= (fail) Parse_shen.<premises>)) (shen.pair (hd Parse_shen.<premises>) (cons (shen.hdtl Parse_shen.<premise>) (shen.hdtl Parse_shen.<premises>))) (fail))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_<e> (<e> V1722) (if (not (= (fail) Parse_<e>)) (shen.pair (hd Parse_<e>) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result)))
|
70
70
|
|
71
|
-
(defun shen.<semicolon-symbol> (
|
71
|
+
(defun shen.<semicolon-symbol> (V1727) (let Result (if (cons? (hd V1727)) (let Parse_X (hd (hd V1727)) (if (= Parse_X ;) (shen.pair (hd (shen.pair (tl (hd V1727)) (shen.hdtl V1727))) shen.skip) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
72
72
|
|
73
|
-
(defun shen.<premise> (
|
73
|
+
(defun shen.<premise> (V1732) (let Result (if (and (cons? (hd V1732)) (= ! (hd (hd V1732)))) (shen.pair (hd (shen.pair (tl (hd V1732)) (shen.hdtl V1732))) !) (fail)) (if (= Result (fail)) (let Result (let Parse_shen.<formulae> (shen.<formulae> V1732) (if (not (= (fail) Parse_shen.<formulae>)) (if (and (cons? (hd Parse_shen.<formulae>)) (= >> (hd (hd Parse_shen.<formulae>)))) (let Parse_shen.<formula> (shen.<formula> (shen.pair (tl (hd Parse_shen.<formulae>)) (shen.hdtl Parse_shen.<formulae>))) (if (not (= (fail) Parse_shen.<formula>)) (shen.pair (hd Parse_shen.<formula>) (shen.sequent (shen.hdtl Parse_shen.<formulae>) (shen.hdtl Parse_shen.<formula>))) (fail))) (fail)) (fail))) (if (= Result (fail)) (let Result (let Parse_shen.<formula> (shen.<formula> V1732) (if (not (= (fail) Parse_shen.<formula>)) (shen.pair (hd Parse_shen.<formula>) (shen.sequent () (shen.hdtl Parse_shen.<formula>))) (fail))) (if (= Result (fail)) (fail) Result)) Result)) Result)))
|
74
74
|
|
75
|
-
(defun shen.<conclusion> (
|
75
|
+
(defun shen.<conclusion> (V1737) (let Result (let Parse_shen.<formulae> (shen.<formulae> V1737) (if (not (= (fail) Parse_shen.<formulae>)) (if (and (cons? (hd Parse_shen.<formulae>)) (= >> (hd (hd Parse_shen.<formulae>)))) (let Parse_shen.<formula> (shen.<formula> (shen.pair (tl (hd Parse_shen.<formulae>)) (shen.hdtl Parse_shen.<formulae>))) (if (not (= (fail) Parse_shen.<formula>)) (let Parse_shen.<semicolon-symbol> (shen.<semicolon-symbol> Parse_shen.<formula>) (if (not (= (fail) Parse_shen.<semicolon-symbol>)) (shen.pair (hd Parse_shen.<semicolon-symbol>) (shen.sequent (shen.hdtl Parse_shen.<formulae>) (shen.hdtl Parse_shen.<formula>))) (fail))) (fail))) (fail)) (fail))) (if (= Result (fail)) (let Result (let Parse_shen.<formula> (shen.<formula> V1737) (if (not (= (fail) Parse_shen.<formula>)) (let Parse_shen.<semicolon-symbol> (shen.<semicolon-symbol> Parse_shen.<formula>) (if (not (= (fail) Parse_shen.<semicolon-symbol>)) (shen.pair (hd Parse_shen.<semicolon-symbol>) (shen.sequent () (shen.hdtl Parse_shen.<formula>))) (fail))) (fail))) (if (= Result (fail)) (fail) Result)) Result)))
|
76
76
|
|
77
|
-
(defun shen.sequent (
|
77
|
+
(defun shen.sequent (V1738 V1739) (@p V1738 V1739))
|
78
78
|
|
79
|
-
(defun shen.<formulae> (
|
79
|
+
(defun shen.<formulae> (V1744) (let Result (let Parse_shen.<formula> (shen.<formula> V1744) (if (not (= (fail) Parse_shen.<formula>)) (let Parse_shen.<comma-symbol> (shen.<comma-symbol> Parse_shen.<formula>) (if (not (= (fail) Parse_shen.<comma-symbol>)) (let Parse_shen.<formulae> (shen.<formulae> Parse_shen.<comma-symbol>) (if (not (= (fail) Parse_shen.<formulae>)) (shen.pair (hd Parse_shen.<formulae>) (cons (shen.hdtl Parse_shen.<formula>) (shen.hdtl Parse_shen.<formulae>))) (fail))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_shen.<formula> (shen.<formula> V1744) (if (not (= (fail) Parse_shen.<formula>)) (shen.pair (hd Parse_shen.<formula>) (cons (shen.hdtl Parse_shen.<formula>) ())) (fail))) (if (= Result (fail)) (let Result (let Parse_<e> (<e> V1744) (if (not (= (fail) Parse_<e>)) (shen.pair (hd Parse_<e>) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result)) Result)))
|
80
80
|
|
81
|
-
(defun shen.<comma-symbol> (
|
81
|
+
(defun shen.<comma-symbol> (V1749) (let Result (if (cons? (hd V1749)) (let Parse_X (hd (hd V1749)) (if (= Parse_X (intern ",")) (shen.pair (hd (shen.pair (tl (hd V1749)) (shen.hdtl V1749))) shen.skip) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
82
82
|
|
83
|
-
(defun shen.<formula> (
|
83
|
+
(defun shen.<formula> (V1754) (let Result (let Parse_shen.<expr> (shen.<expr> V1754) (if (not (= (fail) Parse_shen.<expr>)) (if (and (cons? (hd Parse_shen.<expr>)) (= : (hd (hd Parse_shen.<expr>)))) (let Parse_shen.<type> (shen.<type> (shen.pair (tl (hd Parse_shen.<expr>)) (shen.hdtl Parse_shen.<expr>))) (if (not (= (fail) Parse_shen.<type>)) (shen.pair (hd Parse_shen.<type>) (cons (shen.curry (shen.hdtl Parse_shen.<expr>)) (cons : (cons (shen.demodulate (shen.hdtl Parse_shen.<type>)) ())))) (fail))) (fail)) (fail))) (if (= Result (fail)) (let Result (let Parse_shen.<expr> (shen.<expr> V1754) (if (not (= (fail) Parse_shen.<expr>)) (shen.pair (hd Parse_shen.<expr>) (shen.hdtl Parse_shen.<expr>)) (fail))) (if (= Result (fail)) (fail) Result)) Result)))
|
84
84
|
|
85
|
-
(defun shen.<type> (
|
85
|
+
(defun shen.<type> (V1759) (let Result (let Parse_shen.<expr> (shen.<expr> V1759) (if (not (= (fail) Parse_shen.<expr>)) (shen.pair (hd Parse_shen.<expr>) (shen.curry-type (shen.hdtl Parse_shen.<expr>))) (fail))) (if (= Result (fail)) (fail) Result)))
|
86
86
|
|
87
|
-
(defun shen.<doubleunderline> (
|
87
|
+
(defun shen.<doubleunderline> (V1764) (let Result (if (cons? (hd V1764)) (let Parse_X (hd (hd V1764)) (if (shen.doubleunderline? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1764)) (shen.hdtl V1764))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
88
88
|
|
89
|
-
(defun shen.<singleunderline> (
|
89
|
+
(defun shen.<singleunderline> (V1769) (let Result (if (cons? (hd V1769)) (let Parse_X (hd (hd V1769)) (if (shen.singleunderline? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1769)) (shen.hdtl V1769))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
90
90
|
|
91
|
-
(defun shen.singleunderline? (
|
91
|
+
(defun shen.singleunderline? (V1770) (and (symbol? V1770) (shen.sh? (str V1770))))
|
92
92
|
|
93
|
-
(defun shen.sh? (
|
93
|
+
(defun shen.sh? (V1771) (cond ((= "_" V1771) true) (true (and (= (pos V1771 0) "_") (shen.sh? (tlstr V1771))))))
|
94
94
|
|
95
|
-
(defun shen.doubleunderline? (
|
95
|
+
(defun shen.doubleunderline? (V1772) (and (symbol? V1772) (shen.dh? (str V1772))))
|
96
96
|
|
97
|
-
(defun shen.dh? (
|
97
|
+
(defun shen.dh? (V1773) (cond ((= "=" V1773) true) (true (and (= (pos V1773 0) "=") (shen.dh? (tlstr V1773))))))
|
98
98
|
|
99
|
-
(defun shen.process-datatype (
|
99
|
+
(defun shen.process-datatype (V1774 V1775) (shen.remember-datatype (shen.s-prolog (shen.rules->horn-clauses V1774 V1775))))
|
100
100
|
|
101
|
-
(defun shen.remember-datatype (
|
101
|
+
(defun shen.remember-datatype (V1780) (cond ((cons? V1780) (do (set shen.*datatypes* (adjoin (hd V1780) (value shen.*datatypes*))) (do (set shen.*alldatatypes* (adjoin (hd V1780) (value shen.*alldatatypes*))) (hd V1780)))) (true (shen.sys-error shen.remember-datatype))))
|
102
102
|
|
103
|
-
(defun shen.rules->horn-clauses (
|
103
|
+
(defun shen.rules->horn-clauses (V1783 V1784) (cond ((= () V1784) ()) ((and (cons? V1784) (and (tuple? (hd V1784)) (= shen.single (fst (hd V1784))))) (cons (shen.rule->horn-clause V1783 (snd (hd V1784))) (shen.rules->horn-clauses V1783 (tl V1784)))) ((and (cons? V1784) (and (tuple? (hd V1784)) (= shen.double (fst (hd V1784))))) (shen.rules->horn-clauses V1783 (append (shen.double->singles (snd (hd V1784))) (tl V1784)))) (true (shen.sys-error shen.rules->horn-clauses))))
|
104
104
|
|
105
|
-
(defun shen.double->singles (
|
105
|
+
(defun shen.double->singles (V1785) (cons (shen.right-rule V1785) (cons (shen.left-rule V1785) ())))
|
106
106
|
|
107
|
-
(defun shen.right-rule (
|
107
|
+
(defun shen.right-rule (V1786) (@p shen.single V1786))
|
108
108
|
|
109
|
-
(defun shen.left-rule (
|
109
|
+
(defun shen.left-rule (V1787) (cond ((and (cons? V1787) (and (cons? (tl V1787)) (and (cons? (tl (tl V1787))) (and (tuple? (hd (tl (tl V1787)))) (and (= () (fst (hd (tl (tl V1787))))) (= () (tl (tl (tl V1787))))))))) (let Q (gensym Qv) (let NewConclusion (@p (cons (snd (hd (tl (tl V1787)))) ()) Q) (let NewPremises (cons (@p (map (lambda X1675 (shen.right->left X1675)) (hd (tl V1787))) Q) ()) (@p shen.single (cons (hd V1787) (cons NewPremises (cons NewConclusion ())))))))) (true (shen.sys-error shen.left-rule))))
|
110
110
|
|
111
|
-
(defun shen.right->left (
|
111
|
+
(defun shen.right->left (V1792) (cond ((and (tuple? V1792) (= () (fst V1792))) (snd V1792)) (true (simple-error "syntax error with ==========
|
112
112
|
"))))
|
113
113
|
|
114
|
-
(defun shen.rule->horn-clause (
|
114
|
+
(defun shen.rule->horn-clause (V1793 V1794) (cond ((and (cons? V1794) (and (cons? (tl V1794)) (and (cons? (tl (tl V1794))) (and (tuple? (hd (tl (tl V1794)))) (= () (tl (tl (tl V1794)))))))) (cons (shen.rule->horn-clause-head V1793 (snd (hd (tl (tl V1794))))) (cons :- (cons (shen.rule->horn-clause-body (hd V1794) (hd (tl V1794)) (fst (hd (tl (tl V1794))))) ())))) (true (shen.sys-error shen.rule->horn-clause))))
|
115
115
|
|
116
|
-
(defun shen.rule->horn-clause-head (
|
116
|
+
(defun shen.rule->horn-clause-head (V1795 V1796) (cons V1795 (cons (shen.mode-ify V1796) (cons Context_1957 ()))))
|
117
117
|
|
118
|
-
(defun shen.mode-ify (
|
118
|
+
(defun shen.mode-ify (V1797) (cond ((and (cons? V1797) (and (cons? (tl V1797)) (and (= : (hd (tl V1797))) (and (cons? (tl (tl V1797))) (= () (tl (tl (tl V1797)))))))) (cons mode (cons (cons (hd V1797) (cons : (cons (cons mode (cons (hd (tl (tl V1797))) (cons + ()))) ()))) (cons - ())))) (true V1797)))
|
119
119
|
|
120
|
-
(defun shen.rule->horn-clause-body (
|
120
|
+
(defun shen.rule->horn-clause-body (V1798 V1799 V1800) (let Variables (map (lambda X1676 (shen.extract_vars X1676)) V1800) (let Predicates (map (lambda X (gensym shen.cl)) V1800) (let SearchLiterals (shen.construct-search-literals Predicates Variables Context_1957 Context1_1957) (let SearchClauses (shen.construct-search-clauses Predicates V1800 Variables) (let SideLiterals (shen.construct-side-literals V1798) (let PremissLiterals (map (lambda X (shen.construct-premiss-literal X (empty? V1800))) V1799) (append SearchLiterals (append SideLiterals PremissLiterals)))))))))
|
121
121
|
|
122
|
-
(defun shen.construct-search-literals (
|
122
|
+
(defun shen.construct-search-literals (V1805 V1806 V1807 V1808) (cond ((and (= () V1805) (= () V1806)) ()) (true (shen.csl-help V1805 V1806 V1807 V1808))))
|
123
123
|
|
124
|
-
(defun shen.csl-help (
|
124
|
+
(defun shen.csl-help (V1811 V1812 V1813 V1814) (cond ((and (= () V1811) (= () V1812)) (cons (cons bind (cons ContextOut_1957 (cons V1813 ()))) ())) ((and (cons? V1811) (cons? V1812)) (cons (cons (hd V1811) (cons V1813 (cons V1814 (hd V1812)))) (shen.csl-help (tl V1811) (tl V1812) V1814 (gensym Context)))) (true (shen.sys-error shen.csl-help))))
|
125
125
|
|
126
|
-
(defun shen.construct-search-clauses (
|
126
|
+
(defun shen.construct-search-clauses (V1815 V1816 V1817) (cond ((and (= () V1815) (and (= () V1816) (= () V1817))) shen.skip) ((and (cons? V1815) (and (cons? V1816) (cons? V1817))) (do (shen.construct-search-clause (hd V1815) (hd V1816) (hd V1817)) (shen.construct-search-clauses (tl V1815) (tl V1816) (tl V1817)))) (true (shen.sys-error shen.construct-search-clauses))))
|
127
127
|
|
128
|
-
(defun shen.construct-search-clause (
|
128
|
+
(defun shen.construct-search-clause (V1818 V1819 V1820) (shen.s-prolog (cons (shen.construct-base-search-clause V1818 V1819 V1820) (cons (shen.construct-recursive-search-clause V1818 V1819 V1820) ()))))
|
129
129
|
|
130
|
-
(defun shen.construct-base-search-clause (
|
130
|
+
(defun shen.construct-base-search-clause (V1821 V1822 V1823) (cons (cons V1821 (cons (cons (shen.mode-ify V1822) In_1957) (cons In_1957 V1823))) (cons :- (cons () ()))))
|
131
131
|
|
132
|
-
(defun shen.construct-recursive-search-clause (
|
132
|
+
(defun shen.construct-recursive-search-clause (V1824 V1825 V1826) (cons (cons V1824 (cons (cons Assumption_1957 Assumptions_1957) (cons (cons Assumption_1957 Out_1957) V1826))) (cons :- (cons (cons (cons V1824 (cons Assumptions_1957 (cons Out_1957 V1826))) ()) ()))))
|
133
133
|
|
134
|
-
(defun shen.construct-side-literals (
|
134
|
+
(defun shen.construct-side-literals (V1831) (cond ((= () V1831) ()) ((and (cons? V1831) (and (cons? (hd V1831)) (and (= if (hd (hd V1831))) (and (cons? (tl (hd V1831))) (= () (tl (tl (hd V1831)))))))) (cons (cons when (tl (hd V1831))) (shen.construct-side-literals (tl V1831)))) ((and (cons? V1831) (and (cons? (hd V1831)) (and (= let (hd (hd V1831))) (and (cons? (tl (hd V1831))) (and (cons? (tl (tl (hd V1831)))) (= () (tl (tl (tl (hd V1831)))))))))) (cons (cons is (tl (hd V1831))) (shen.construct-side-literals (tl V1831)))) ((cons? V1831) (shen.construct-side-literals (tl V1831))) (true (shen.sys-error shen.construct-side-literals))))
|
135
135
|
|
136
|
-
(defun shen.construct-premiss-literal (
|
136
|
+
(defun shen.construct-premiss-literal (V1836 V1837) (cond ((tuple? V1836) (cons shen.t* (cons (shen.recursive_cons_form (snd V1836)) (cons (shen.construct-context V1837 (fst V1836)) ())))) ((= ! V1836) (cons cut (cons Throwcontrol ()))) (true (shen.sys-error shen.construct-premiss-literal))))
|
137
137
|
|
138
|
-
(defun shen.construct-context (
|
138
|
+
(defun shen.construct-context (V1838 V1839) (cond ((and (= true V1838) (= () V1839)) Context_1957) ((and (= false V1838) (= () V1839)) ContextOut_1957) ((cons? V1839) (cons cons (cons (shen.recursive_cons_form (hd V1839)) (cons (shen.construct-context V1838 (tl V1839)) ())))) (true (shen.sys-error shen.construct-context))))
|
139
139
|
|
140
|
-
(defun shen.recursive_cons_form (
|
140
|
+
(defun shen.recursive_cons_form (V1840) (cond ((cons? V1840) (cons cons (cons (shen.recursive_cons_form (hd V1840)) (cons (shen.recursive_cons_form (tl V1840)) ())))) (true V1840)))
|
141
141
|
|
142
|
-
(defun preclude (
|
142
|
+
(defun preclude (V1841) (shen.preclude-h (map (lambda X1677 (shen.intern-type X1677)) V1841)))
|
143
143
|
|
144
|
-
(defun shen.preclude-h (
|
144
|
+
(defun shen.preclude-h (V1842) (let FilterDatatypes (set shen.*datatypes* (difference (value shen.*datatypes*) V1842)) (value shen.*datatypes*)))
|
145
145
|
|
146
|
-
(defun include (
|
146
|
+
(defun include (V1843) (shen.include-h (map (lambda X1678 (shen.intern-type X1678)) V1843)))
|
147
147
|
|
148
|
-
(defun shen.include-h (
|
148
|
+
(defun shen.include-h (V1844) (let ValidTypes (intersection V1844 (value shen.*alldatatypes*)) (let NewDatatypes (set shen.*datatypes* (union ValidTypes (value shen.*datatypes*))) (value shen.*datatypes*))))
|
149
149
|
|
150
|
-
(defun preclude-all-but (
|
150
|
+
(defun preclude-all-but (V1845) (shen.preclude-h (difference (value shen.*alldatatypes*) (map (lambda X1679 (shen.intern-type X1679)) V1845))))
|
151
151
|
|
152
|
-
(defun include-all-but (
|
152
|
+
(defun include-all-but (V1846) (shen.include-h (difference (value shen.*alldatatypes*) (map (lambda X1680 (shen.intern-type X1680)) V1846))))
|
153
153
|
|
154
|
-
(defun shen.synonyms-help (
|
154
|
+
(defun shen.synonyms-help (V1851) (cond ((= () V1851) (shen.demodulation-function (value shen.*tc*) (mapcan (lambda X1681 (shen.demod-rule X1681)) (value shen.*synonyms*)))) ((and (cons? V1851) (cons? (tl V1851))) (let Vs (difference (shen.extract_vars (hd (tl V1851))) (shen.extract_vars (hd V1851))) (if (empty? Vs) (do (shen.pushnew (cons (hd V1851) (cons (hd (tl V1851)) ())) shen.*synonyms*) (shen.synonyms-help (tl (tl V1851)))) (shen.free_variable_warnings (hd (tl V1851)) Vs)))) (true (simple-error "odd number of synonyms
|
155
155
|
"))))
|
156
156
|
|
157
|
-
(defun shen.pushnew (
|
157
|
+
(defun shen.pushnew (V1852 V1853) (if (element? V1852 (value V1853)) (value V1853) (set V1853 (cons V1852 (value V1853)))))
|
158
158
|
|
159
|
-
(defun shen.demod-rule (
|
159
|
+
(defun shen.demod-rule (V1854) (cond ((and (cons? V1854) (and (cons? (tl V1854)) (= () (tl (tl V1854))))) (cons (shen.rcons_form (hd V1854)) (cons -> (cons (shen.rcons_form (hd (tl V1854))) ())))) (true (shen.sys-error shen.demod-rule))))
|
160
160
|
|
161
|
-
(defun shen.demodulation-function (
|
161
|
+
(defun shen.demodulation-function (V1855 V1856) (do (tc -) (do (eval (cons define (cons shen.demod (append V1856 (shen.default-rule))))) (do (if V1855 (tc +) shen.skip) synonyms))))
|
162
162
|
|
163
163
|
(defun shen.default-rule () (cons X (cons -> (cons X ()))))
|
164
164
|
|
@@ -47,210 +47,210 @@
|
|
47
47
|
* explains this license in full. *
|
48
48
|
* *
|
49
49
|
*****************************************************************************************
|
50
|
-
"(defun thaw (
|
50
|
+
"(defun thaw (V1862) (V1862))
|
51
51
|
|
52
|
-
(defun eval (
|
52
|
+
(defun eval (V1863) (let Macroexpand (shen.walk (lambda X1857 (macroexpand X1857)) V1863) (if (shen.packaged? Macroexpand) (map (lambda X1858 (shen.eval-without-macros X1858)) (shen.package-contents Macroexpand)) (shen.eval-without-macros Macroexpand))))
|
53
53
|
|
54
|
-
(defun shen.eval-without-macros (
|
54
|
+
(defun shen.eval-without-macros (V1864) (eval-kl (shen.elim-def (shen.proc-input+ V1864))))
|
55
55
|
|
56
|
-
(defun shen.proc-input+ (
|
56
|
+
(defun shen.proc-input+ (V1865) (cond ((and (cons? V1865) (and (= input+ (hd V1865)) (and (cons? (tl V1865)) (and (cons? (tl (tl V1865))) (= () (tl (tl (tl V1865)))))))) (cons input+ (cons (shen.rcons_form (hd (tl V1865))) (tl (tl V1865))))) ((and (cons? V1865) (and (= read+ (hd V1865)) (and (cons? (tl V1865)) (and (cons? (tl (tl V1865))) (= () (tl (tl (tl V1865)))))))) (cons read+ (cons (shen.rcons_form (hd (tl V1865))) (tl (tl V1865))))) ((cons? V1865) (map (lambda X1859 (shen.proc-input+ X1859)) V1865)) (true V1865)))
|
57
57
|
|
58
|
-
(defun shen.elim-def (
|
58
|
+
(defun shen.elim-def (V1866) (cond ((and (cons? V1866) (and (= define (hd V1866)) (cons? (tl V1866)))) (shen.shen->kl (hd (tl V1866)) (tl (tl V1866)))) ((and (cons? V1866) (and (= defmacro (hd V1866)) (cons? (tl V1866)))) (let Default (cons X (cons -> (cons X ()))) (let Def (shen.elim-def (cons define (cons (hd (tl V1866)) (append (tl (tl V1866)) Default)))) (let MacroAdd (shen.add-macro (hd (tl V1866))) Def)))) ((and (cons? V1866) (and (= defcc (hd V1866)) (cons? (tl V1866)))) (shen.elim-def (shen.yacc V1866))) ((cons? V1866) (map (lambda X1860 (shen.elim-def X1860)) V1866)) (true V1866)))
|
59
59
|
|
60
|
-
(defun shen.add-macro (
|
60
|
+
(defun shen.add-macro (V1867) (set *macros* (adjoin V1867 (value *macros*))))
|
61
61
|
|
62
|
-
(defun shen.packaged? (
|
62
|
+
(defun shen.packaged? (V1874) (cond ((and (cons? V1874) (and (= package (hd V1874)) (and (cons? (tl V1874)) (cons? (tl (tl V1874)))))) true) (true false)))
|
63
63
|
|
64
|
-
(defun external (
|
64
|
+
(defun external (V1875) (trap-error (get V1875 shen.external-symbols (value *property-vector*)) (lambda E (simple-error (cn "package " (shen.app V1875 " has not been used.
|
65
65
|
" shen.a))))))
|
66
66
|
|
67
|
-
(defun shen.package-contents (
|
67
|
+
(defun shen.package-contents (V1878) (cond ((and (cons? V1878) (and (= package (hd V1878)) (and (cons? (tl V1878)) (and (= null (hd (tl V1878))) (cons? (tl (tl V1878))))))) (tl (tl (tl V1878)))) ((and (cons? V1878) (and (= package (hd V1878)) (and (cons? (tl V1878)) (cons? (tl (tl V1878)))))) (shen.packageh (hd (tl V1878)) (hd (tl (tl V1878))) (tl (tl (tl V1878))))) (true (shen.sys-error shen.package-contents))))
|
68
68
|
|
69
|
-
(defun shen.walk (
|
69
|
+
(defun shen.walk (V1879 V1880) (cond ((cons? V1880) (V1879 (map (lambda Z (shen.walk V1879 Z)) V1880))) (true (V1879 V1880))))
|
70
70
|
|
71
|
-
(defun compile (
|
71
|
+
(defun compile (V1881 V1882 V1883) (let O (V1881 (cons V1882 (cons () ()))) (if (or (= (fail) O) (not (empty? (hd O)))) (V1883 O) (shen.hdtl O))))
|
72
72
|
|
73
|
-
(defun fail-if (
|
73
|
+
(defun fail-if (V1884 V1885) (if (V1884 V1885) (fail) V1885))
|
74
74
|
|
75
|
-
(defun @s (
|
75
|
+
(defun @s (V1886 V1887) (cn V1886 V1887))
|
76
76
|
|
77
77
|
(defun tc? () (value shen.*tc*))
|
78
78
|
|
79
|
-
(defun ps (
|
79
|
+
(defun ps (V1888) (trap-error (get V1888 shen.source (value *property-vector*)) (lambda E (simple-error (shen.app V1888 " not found.
|
80
80
|
" shen.a)))))
|
81
81
|
|
82
82
|
(defun stinput () (value *stinput*))
|
83
83
|
|
84
|
-
(defun shen.+vector? (
|
84
|
+
(defun shen.+vector? (V1889) (and (absvector? V1889) (> (<-address V1889 0) 0)))
|
85
85
|
|
86
|
-
(defun vector (
|
86
|
+
(defun vector (V1890) (let Vector (absvector (+ V1890 1)) (let ZeroStamp (address-> Vector 0 V1890) (let Standard (if (= V1890 0) ZeroStamp (shen.fillvector ZeroStamp 1 V1890 (fail))) Standard))))
|
87
87
|
|
88
|
-
(defun shen.fillvector (
|
88
|
+
(defun shen.fillvector (V1891 V1892 V1893 V1894) (cond ((= V1893 V1892) (address-> V1891 V1893 V1894)) (true (shen.fillvector (address-> V1891 V1892 V1894) (+ 1 V1892) V1893 V1894))))
|
89
89
|
|
90
|
-
(defun vector? (
|
90
|
+
(defun vector? (V1896) (and (absvector? V1896) (trap-error (>= (<-address V1896 0) 0) (lambda E false))))
|
91
91
|
|
92
|
-
(defun vector-> (
|
93
|
-
") (address->
|
92
|
+
(defun vector-> (V1897 V1898 V1899) (if (= V1898 0) (simple-error "cannot access 0th element of a vector
|
93
|
+
") (address-> V1897 V1898 V1899)))
|
94
94
|
|
95
|
-
(defun <-vector (
|
96
|
-
") (let VectorElement (<-address
|
95
|
+
(defun <-vector (V1900 V1901) (if (= V1901 0) (simple-error "cannot access 0th element of a vector
|
96
|
+
") (let VectorElement (<-address V1900 V1901) (if (= VectorElement (fail)) (simple-error "vector element not found
|
97
97
|
") VectorElement))))
|
98
98
|
|
99
|
-
(defun shen.posint? (
|
99
|
+
(defun shen.posint? (V1902) (and (integer? V1902) (>= V1902 0)))
|
100
100
|
|
101
|
-
(defun limit (
|
101
|
+
(defun limit (V1903) (<-address V1903 0))
|
102
102
|
|
103
|
-
(defun symbol? (
|
103
|
+
(defun symbol? (V1904) (cond ((or (boolean? V1904) (or (number? V1904) (string? V1904))) false) (true (trap-error (let String (str V1904) (shen.analyse-symbol? String)) (lambda E false)))))
|
104
104
|
|
105
|
-
(defun shen.analyse-symbol? (
|
105
|
+
(defun shen.analyse-symbol? (V1905) (cond ((shen.+string? V1905) (and (shen.alpha? (pos V1905 0)) (shen.alphanums? (tlstr V1905)))) (true (shen.sys-error shen.analyse-symbol?))))
|
106
106
|
|
107
|
-
(defun shen.alpha? (
|
107
|
+
(defun shen.alpha? (V1906) (element? V1906 (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 "." ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
108
108
|
|
109
|
-
(defun shen.alphanums? (
|
109
|
+
(defun shen.alphanums? (V1907) (cond ((= "" V1907) true) ((shen.+string? V1907) (and (shen.alphanum? (pos V1907 0)) (shen.alphanums? (tlstr V1907)))) (true (shen.sys-error shen.alphanums?))))
|
110
110
|
|
111
|
-
(defun shen.alphanum? (
|
111
|
+
(defun shen.alphanum? (V1908) (or (shen.alpha? V1908) (shen.digit? V1908)))
|
112
112
|
|
113
|
-
(defun shen.digit? (
|
113
|
+
(defun shen.digit? (V1909) (element? V1909 (cons "1" (cons "2" (cons "3" (cons "4" (cons "5" (cons "6" (cons "7" (cons "8" (cons "9" (cons "0" ()))))))))))))
|
114
114
|
|
115
|
-
(defun variable? (
|
115
|
+
(defun variable? (V1910) (cond ((or (boolean? V1910) (or (number? V1910) (string? V1910))) false) (true (trap-error (let String (str V1910) (shen.analyse-variable? String)) (lambda E false)))))
|
116
116
|
|
117
|
-
(defun shen.analyse-variable? (
|
117
|
+
(defun shen.analyse-variable? (V1911) (cond ((shen.+string? V1911) (and (shen.uppercase? (pos V1911 0)) (shen.alphanums? (tlstr V1911)))) (true (shen.sys-error shen.analyse-variable?))))
|
118
118
|
|
119
|
-
(defun shen.uppercase? (
|
119
|
+
(defun shen.uppercase? (V1912) (element? V1912 (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" ()))))))))))))))))))))))))))))
|
120
120
|
|
121
|
-
(defun gensym (
|
121
|
+
(defun gensym (V1913) (concat V1913 (set shen.*gensym* (+ 1 (value shen.*gensym*)))))
|
122
122
|
|
123
|
-
(defun concat (
|
123
|
+
(defun concat (V1914 V1915) (intern (cn (str V1914) (str V1915))))
|
124
124
|
|
125
|
-
(defun @p (
|
125
|
+
(defun @p (V1916 V1917) (let Vector (absvector 3) (let Tag (address-> Vector 0 shen.tuple) (let Fst (address-> Vector 1 V1916) (let Snd (address-> Vector 2 V1917) Vector)))))
|
126
126
|
|
127
|
-
(defun fst (
|
127
|
+
(defun fst (V1918) (<-address V1918 1))
|
128
128
|
|
129
|
-
(defun snd (
|
129
|
+
(defun snd (V1919) (<-address V1919 2))
|
130
130
|
|
131
|
-
(defun tuple? (
|
131
|
+
(defun tuple? (V1920) (trap-error (and (absvector? V1920) (= shen.tuple (<-address V1920 0))) (lambda E false)))
|
132
132
|
|
133
|
-
(defun append (
|
133
|
+
(defun append (V1921 V1922) (cond ((= () V1921) V1922) ((cons? V1921) (cons (hd V1921) (append (tl V1921) V1922))) (true (shen.sys-error append))))
|
134
134
|
|
135
|
-
(defun @v (
|
135
|
+
(defun @v (V1923 V1924) (let Limit (limit V1924) (let NewVector (vector (+ Limit 1)) (let X+NewVector (vector-> NewVector 1 V1923) (if (= Limit 0) X+NewVector (shen.@v-help V1924 1 Limit X+NewVector))))))
|
136
136
|
|
137
|
-
(defun shen.@v-help (
|
137
|
+
(defun shen.@v-help (V1925 V1926 V1927 V1928) (cond ((= V1927 V1926) (shen.copyfromvector V1925 V1928 V1927 (+ V1927 1))) (true (shen.@v-help V1925 (+ V1926 1) V1927 (shen.copyfromvector V1925 V1928 V1926 (+ V1926 1))))))
|
138
138
|
|
139
|
-
(defun shen.copyfromvector (
|
139
|
+
(defun shen.copyfromvector (V1930 V1931 V1932 V1933) (trap-error (vector-> V1931 V1933 (<-vector V1930 V1932)) (lambda E V1931)))
|
140
140
|
|
141
|
-
(defun hdv (
|
141
|
+
(defun hdv (V1934) (trap-error (<-vector V1934 1) (lambda E (simple-error (cn "hdv needs a non-empty vector as an argument; not " (shen.app V1934 "
|
142
142
|
" shen.s))))))
|
143
143
|
|
144
|
-
(defun tlv (
|
145
|
-
") (if (= Limit 1) (vector 0) (let NewVector (vector (- Limit 1)) (shen.tlv-help
|
144
|
+
(defun tlv (V1935) (let Limit (limit V1935) (if (= Limit 0) (simple-error "cannot take the tail of the empty vector
|
145
|
+
") (if (= Limit 1) (vector 0) (let NewVector (vector (- Limit 1)) (shen.tlv-help V1935 2 Limit (vector (- Limit 1))))))))
|
146
146
|
|
147
|
-
(defun shen.tlv-help (
|
147
|
+
(defun shen.tlv-help (V1936 V1937 V1938 V1939) (cond ((= V1938 V1937) (shen.copyfromvector V1936 V1939 V1938 (- V1938 1))) (true (shen.tlv-help V1936 (+ V1937 1) V1938 (shen.copyfromvector V1936 V1939 V1937 (- V1937 1))))))
|
148
148
|
|
149
|
-
(defun assoc (
|
149
|
+
(defun assoc (V1949 V1950) (cond ((= () V1950) ()) ((and (cons? V1950) (and (cons? (hd V1950)) (= (hd (hd V1950)) V1949))) (hd V1950)) ((cons? V1950) (assoc V1949 (tl V1950))) (true (shen.sys-error assoc))))
|
150
150
|
|
151
|
-
(defun boolean? (
|
151
|
+
(defun boolean? (V1956) (cond ((= true V1956) true) ((= false V1956) true) (true false)))
|
152
152
|
|
153
|
-
(defun nl (
|
154
|
-
" (stoutput)) (nl (-
|
153
|
+
(defun nl (V1957) (cond ((= 0 V1957) 0) (true (do (shen.prhush "
|
154
|
+
" (stoutput)) (nl (- V1957 1))))))
|
155
155
|
|
156
|
-
(defun difference (
|
156
|
+
(defun difference (V1960 V1961) (cond ((= () V1960) ()) ((cons? V1960) (if (element? (hd V1960) V1961) (difference (tl V1960) V1961) (cons (hd V1960) (difference (tl V1960) V1961)))) (true (shen.sys-error difference))))
|
157
157
|
|
158
|
-
(defun do (
|
158
|
+
(defun do (V1962 V1963) V1963)
|
159
159
|
|
160
|
-
(defun element? (
|
160
|
+
(defun element? (V1972 V1973) (cond ((= () V1973) false) ((and (cons? V1973) (= (hd V1973) V1972)) true) ((cons? V1973) (element? V1972 (tl V1973))) (true (shen.sys-error element?))))
|
161
161
|
|
162
|
-
(defun empty? (
|
162
|
+
(defun empty? (V1979) (cond ((= () V1979) true) (true false)))
|
163
163
|
|
164
|
-
(defun fix (
|
164
|
+
(defun fix (V1980 V1981) (shen.fix-help V1980 V1981 (V1980 V1981)))
|
165
165
|
|
166
|
-
(defun shen.fix-help (
|
166
|
+
(defun shen.fix-help (V1988 V1989 V1990) (cond ((= V1990 V1989) V1990) (true (shen.fix-help V1988 V1990 (V1988 V1990)))))
|
167
167
|
|
168
|
-
(defun put (
|
168
|
+
(defun put (V1992 V1993 V1994 V1995) (let N (hash V1992 (limit V1995)) (let Entry (trap-error (<-vector V1995 N) (lambda E ())) (let Change (vector-> V1995 N (shen.change-pointer-value V1992 V1993 V1994 Entry)) V1994))))
|
169
169
|
|
170
|
-
(defun shen.change-pointer-value (
|
170
|
+
(defun shen.change-pointer-value (V1998 V1999 V2000 V2001) (cond ((= () V2001) (cons (cons (cons V1998 (cons V1999 ())) V2000) ())) ((and (cons? V2001) (and (cons? (hd V2001)) (and (cons? (hd (hd V2001))) (and (cons? (tl (hd (hd V2001)))) (and (= () (tl (tl (hd (hd V2001))))) (and (= (hd (tl (hd (hd V2001)))) V1999) (= (hd (hd (hd V2001))) V1998))))))) (cons (cons (hd (hd V2001)) V2000) (tl V2001))) ((cons? V2001) (cons (hd V2001) (shen.change-pointer-value V1998 V1999 V2000 (tl V2001)))) (true (shen.sys-error shen.change-pointer-value))))
|
171
171
|
|
172
|
-
(defun get (
|
173
|
-
"))) (let Result (assoc (cons
|
172
|
+
(defun get (V2004 V2005 V2006) (let N (hash V2004 (limit V2006)) (let Entry (trap-error (<-vector V2006 N) (lambda E (simple-error "pointer not found
|
173
|
+
"))) (let Result (assoc (cons V2004 (cons V2005 ())) Entry) (if (empty? Result) (simple-error "value not found
|
174
174
|
") (tl Result))))))
|
175
175
|
|
176
|
-
(defun hash (
|
176
|
+
(defun hash (V2007 V2008) (let Hash (shen.mod (sum (map (lambda X1861 (string->n X1861)) (explode V2007))) V2008) (if (= 0 Hash) 1 Hash)))
|
177
177
|
|
178
|
-
(defun shen.mod (
|
178
|
+
(defun shen.mod (V2009 V2010) (shen.modh V2009 (shen.multiples V2009 (cons V2010 ()))))
|
179
179
|
|
180
|
-
(defun shen.multiples (
|
180
|
+
(defun shen.multiples (V2011 V2012) (cond ((and (cons? V2012) (> (hd V2012) V2011)) (tl V2012)) ((cons? V2012) (shen.multiples V2011 (cons (* 2 (hd V2012)) V2012))) (true (shen.sys-error shen.multiples))))
|
181
181
|
|
182
|
-
(defun shen.modh (
|
182
|
+
(defun shen.modh (V2015 V2016) (cond ((= 0 V2015) 0) ((= () V2016) V2015) ((and (cons? V2016) (> (hd V2016) V2015)) (if (empty? (tl V2016)) V2015 (shen.modh V2015 (tl V2016)))) ((cons? V2016) (shen.modh (- V2015 (hd V2016)) V2016)) (true (shen.sys-error shen.modh))))
|
183
183
|
|
184
|
-
(defun sum (
|
184
|
+
(defun sum (V2017) (cond ((= () V2017) 0) ((cons? V2017) (+ (hd V2017) (sum (tl V2017)))) (true (shen.sys-error sum))))
|
185
185
|
|
186
|
-
(defun head (
|
186
|
+
(defun head (V2024) (cond ((cons? V2024) (hd V2024)) (true (simple-error "head expects a non-empty list"))))
|
187
187
|
|
188
|
-
(defun tail (
|
188
|
+
(defun tail (V2031) (cond ((cons? V2031) (tl V2031)) (true (simple-error "tail expects a non-empty list"))))
|
189
189
|
|
190
|
-
(defun hdstr (
|
190
|
+
(defun hdstr (V2032) (pos V2032 0))
|
191
191
|
|
192
|
-
(defun intersection (
|
192
|
+
(defun intersection (V2035 V2036) (cond ((= () V2035) ()) ((cons? V2035) (if (element? (hd V2035) V2036) (cons (hd V2035) (intersection (tl V2035) V2036)) (intersection (tl V2035) V2036))) (true (shen.sys-error intersection))))
|
193
193
|
|
194
|
-
(defun reverse (
|
194
|
+
(defun reverse (V2037) (shen.reverse_help V2037 ()))
|
195
195
|
|
196
|
-
(defun shen.reverse_help (
|
196
|
+
(defun shen.reverse_help (V2038 V2039) (cond ((= () V2038) V2039) ((cons? V2038) (shen.reverse_help (tl V2038) (cons (hd V2038) V2039))) (true (shen.sys-error shen.reverse_help))))
|
197
197
|
|
198
|
-
(defun union (
|
198
|
+
(defun union (V2040 V2041) (cond ((= () V2040) V2041) ((cons? V2040) (if (element? (hd V2040) V2041) (union (tl V2040) V2041) (cons (hd V2040) (union (tl V2040) V2041)))) (true (shen.sys-error union))))
|
199
199
|
|
200
|
-
(defun y-or-n? (
|
201
|
-
" (stoutput)) (y-or-n?
|
200
|
+
(defun y-or-n? (V2042) (let Message (shen.prhush (shen.proc-nl V2042) (stoutput)) (let Y-or-N (shen.prhush " (y/n) " (stoutput)) (let Input (shen.app (read (stinput)) "" shen.s) (if (= "y" Input) true (if (= "n" Input) false (do (shen.prhush "please answer y or n
|
201
|
+
" (stoutput)) (y-or-n? V2042))))))))
|
202
202
|
|
203
|
-
(defun not (
|
203
|
+
(defun not (V2043) (if V2043 false true))
|
204
204
|
|
205
|
-
(defun subst (
|
205
|
+
(defun subst (V2052 V2053 V2054) (cond ((= V2054 V2053) V2052) ((cons? V2054) (map (lambda W (subst V2052 V2053 W)) V2054)) (true V2054)))
|
206
206
|
|
207
|
-
(defun explode (
|
207
|
+
(defun explode (V2056) (shen.explode-h (shen.app V2056 "" shen.a)))
|
208
208
|
|
209
|
-
(defun shen.explode-h (
|
209
|
+
(defun shen.explode-h (V2057) (cond ((= "" V2057) ()) ((shen.+string? V2057) (cons (pos V2057 0) (shen.explode-h (tlstr V2057)))) (true (shen.sys-error shen.explode-h))))
|
210
210
|
|
211
|
-
(defun cd (
|
211
|
+
(defun cd (V2058) (set *home-directory* (if (= V2058 "") "" (shen.app V2058 "/" shen.a))))
|
212
212
|
|
213
|
-
(defun map (
|
213
|
+
(defun map (V2059 V2060) (shen.map-h V2059 V2060 ()))
|
214
214
|
|
215
|
-
(defun shen.map-h (
|
215
|
+
(defun shen.map-h (V2063 V2064 V2065) (cond ((= () V2064) (reverse V2065)) ((cons? V2064) (shen.map-h V2063 (tl V2064) (cons (V2063 (hd V2064)) V2065))) (true (shen.sys-error shen.map-h))))
|
216
216
|
|
217
|
-
(defun length (
|
217
|
+
(defun length (V2066) (shen.length-h V2066 0))
|
218
218
|
|
219
|
-
(defun shen.length-h (
|
219
|
+
(defun shen.length-h (V2067 V2068) (cond ((= () V2067) V2068) (true (shen.length-h (tl V2067) (+ V2068 1)))))
|
220
220
|
|
221
|
-
(defun occurrences (
|
221
|
+
(defun occurrences (V2077 V2078) (cond ((= V2078 V2077) 1) ((cons? V2078) (+ (occurrences V2077 (hd V2078)) (occurrences V2077 (tl V2078)))) (true 0)))
|
222
222
|
|
223
|
-
(defun nth (
|
223
|
+
(defun nth (V2086 V2087) (cond ((and (= 1 V2086) (cons? V2087)) (hd V2087)) ((cons? V2087) (nth (- V2086 1) (tl V2087))) (true (shen.sys-error nth))))
|
224
224
|
|
225
|
-
(defun integer? (
|
225
|
+
(defun integer? (V2088) (and (number? V2088) (let Abs (shen.abs V2088) (shen.integer-test? Abs (shen.magless Abs 1)))))
|
226
226
|
|
227
|
-
(defun shen.abs (
|
227
|
+
(defun shen.abs (V2089) (if (> V2089 0) V2089 (- 0 V2089)))
|
228
228
|
|
229
|
-
(defun shen.magless (
|
229
|
+
(defun shen.magless (V2090 V2091) (let Nx2 (* V2091 2) (if (> Nx2 V2090) V2091 (shen.magless V2090 Nx2))))
|
230
230
|
|
231
|
-
(defun shen.integer-test? (
|
231
|
+
(defun shen.integer-test? (V2095 V2096) (cond ((= 0 V2095) true) ((> 1 V2095) false) (true (let Abs-N (- V2095 V2096) (if (> 0 Abs-N) (integer? V2095) (shen.integer-test? Abs-N V2096))))))
|
232
232
|
|
233
|
-
(defun mapcan (
|
233
|
+
(defun mapcan (V2099 V2100) (cond ((= () V2100) ()) ((cons? V2100) (append (V2099 (hd V2100)) (mapcan V2099 (tl V2100)))) (true (shen.sys-error mapcan))))
|
234
234
|
|
235
|
-
(defun == (
|
235
|
+
(defun == (V2109 V2110) (cond ((= V2110 V2109) true) (true false)))
|
236
236
|
|
237
237
|
(defun abort () (simple-error ""))
|
238
238
|
|
239
|
-
(defun bound? (
|
239
|
+
(defun bound? (V2112) (and (symbol? V2112) (let Val (trap-error (value V2112) (lambda E shen.this-symbol-is-unbound)) (if (= Val shen.this-symbol-is-unbound) false true))))
|
240
240
|
|
241
|
-
(defun shen.string->bytes (
|
241
|
+
(defun shen.string->bytes (V2113) (cond ((= "" V2113) ()) (true (cons (string->n (pos V2113 0)) (shen.string->bytes (tlstr V2113))))))
|
242
242
|
|
243
|
-
(defun maxinferences (
|
243
|
+
(defun maxinferences (V2114) (set shen.*maxinferences* V2114))
|
244
244
|
|
245
245
|
(defun inferences () (value shen.*infs*))
|
246
246
|
|
247
|
-
(defun protect (
|
247
|
+
(defun protect (V2115) V2115)
|
248
248
|
|
249
249
|
(defun stoutput () (value *stoutput*))
|
250
250
|
|
251
|
-
(defun string->symbol (
|
251
|
+
(defun string->symbol (V2116) (let Symbol (intern V2116) (if (symbol? Symbol) Symbol (simple-error (cn "cannot intern " (shen.app V2116 " to a symbol" shen.s))))))
|
252
252
|
|
253
|
-
(defun shen.optimise (
|
253
|
+
(defun shen.optimise (V2121) (cond ((= + V2121) (set shen.*optimise* true)) ((= - V2121) (set shen.*optimise* false)) (true (simple-error "optimise expects a + or a -.
|
254
254
|
"))))
|
255
255
|
|
256
256
|
(defun os () (value *os*))
|