shen-ruby 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/HISTORY.md +10 -0
- data/README.md +19 -17
- data/lib/kl/primitives/streams.rb +7 -17
- data/lib/shen_ruby/version.rb +1 -1
- data/shen/README.txt +1 -1
- data/shen/release/k_lambda/core.kl +56 -56
- data/shen/release/k_lambda/declarations.kl +8 -8
- data/shen/release/k_lambda/load.kl +15 -15
- data/shen/release/k_lambda/macros.kl +30 -28
- data/shen/release/k_lambda/prolog.kl +97 -97
- data/shen/release/k_lambda/reader.kl +91 -69
- data/shen/release/k_lambda/sequent.kl +53 -53
- data/shen/release/k_lambda/sys.kl +92 -108
- data/shen/release/k_lambda/t-star.kl +50 -55
- data/shen/release/k_lambda/toplevel.kl +23 -23
- data/shen/release/k_lambda/types.kl +2 -2
- data/shen/release/k_lambda/writer.kl +28 -22
- data/shen/release/test_programs/interpreter.shen +4 -6
- data/shen/release/test_programs/proof_assistant.shen +3 -3
- data/shen/release/test_programs/whist.shen +2 -2
- data/shen-ruby.gemspec +2 -2
- metadata +9 -13
@@ -47,114 +47,114 @@
|
|
47
47
|
* explains this license in full. *
|
48
48
|
* *
|
49
49
|
*****************************************************************************************
|
50
|
-
"(defun shen.datatype-error (
|
50
|
+
"(defun shen.datatype-error (V1632) (cond ((and (cons? V1632) (and (cons? (tl V1632)) (= () (tl (tl V1632))))) (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 V1632)) "
|
53
53
|
" shen.a)))) (true (shen.sys-error shen.datatype-error))))
|
54
54
|
|
55
|
-
(defun shen.<datatype-rules> (
|
55
|
+
(defun shen.<datatype-rules> (V1637) (let Result (let Parse_shen.<datatype-rule> (shen.<datatype-rule> V1637) (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> V1637) (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> (V1642) (let Result (let Parse_shen.<side-conditions> (shen.<side-conditions> V1642) (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> V1642) (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> (V1647) (let Result (let Parse_shen.<side-condition> (shen.<side-condition> V1647) (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> V1647) (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> (V1652) (let Result (if (and (cons? (hd V1652)) (= if (hd (hd V1652)))) (let Parse_shen.<expr> (shen.<expr> (shen.pair (tl (hd V1652)) (shen.hdtl V1652))) (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 V1652)) (= let (hd (hd V1652)))) (let Parse_shen.<variable?> (shen.<variable?> (shen.pair (tl (hd V1652)) (shen.hdtl V1652))) (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?> (V1657) (let Result (if (cons? (hd V1657)) (let Parse_X (hd (hd V1657)) (if (variable? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1657)) (shen.hdtl V1657))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
64
64
|
|
65
|
-
(defun shen.<expr> (
|
65
|
+
(defun shen.<expr> (V1662) (let Result (if (cons? (hd V1662)) (let Parse_X (hd (hd V1662)) (if (not (or (element? Parse_X (cons >> (cons ; ()))) (or (shen.singleunderline? Parse_X) (shen.doubleunderline? Parse_X)))) (shen.pair (hd (shen.pair (tl (hd V1662)) (shen.hdtl V1662))) (shen.remove-bar Parse_X)) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
66
66
|
|
67
|
-
(defun shen.remove-bar (
|
67
|
+
(defun shen.remove-bar (V1663) (cond ((and (cons? V1663) (and (cons? (tl V1663)) (and (cons? (tl (tl V1663))) (and (= () (tl (tl (tl V1663)))) (= (hd (tl V1663)) bar!))))) (cons (hd V1663) (hd (tl (tl V1663))))) ((cons? V1663) (cons (shen.remove-bar (hd V1663)) (shen.remove-bar (tl V1663)))) (true V1663)))
|
68
68
|
|
69
|
-
(defun shen.<premises> (
|
69
|
+
(defun shen.<premises> (V1668) (let Result (let Parse_shen.<premise> (shen.<premise> V1668) (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> V1668) (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> (V1673) (let Result (if (cons? (hd V1673)) (let Parse_X (hd (hd V1673)) (if (= Parse_X ;) (shen.pair (hd (shen.pair (tl (hd V1673)) (shen.hdtl V1673))) shen.skip) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
72
72
|
|
73
|
-
(defun shen.<premise> (
|
73
|
+
(defun shen.<premise> (V1678) (let Result (if (and (cons? (hd V1678)) (= ! (hd (hd V1678)))) (shen.pair (hd (shen.pair (tl (hd V1678)) (shen.hdtl V1678))) !) (fail)) (if (= Result (fail)) (let Result (let Parse_shen.<formulae> (shen.<formulae> V1678) (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> V1678) (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> (V1683) (let Result (let Parse_shen.<formulae> (shen.<formulae> V1683) (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> V1683) (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 (V1684 V1685) (@p V1684 V1685))
|
78
78
|
|
79
|
-
(defun shen.<formulae> (
|
79
|
+
(defun shen.<formulae> (V1690) (let Result (let Parse_shen.<formula> (shen.<formula> V1690) (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> V1690) (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> V1690) (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> (V1695) (let Result (if (cons? (hd V1695)) (let Parse_X (hd (hd V1695)) (if (= Parse_X (intern ",")) (shen.pair (hd (shen.pair (tl (hd V1695)) (shen.hdtl V1695))) shen.skip) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
82
82
|
|
83
|
-
(defun shen.<formula> (
|
83
|
+
(defun shen.<formula> (V1700) (let Result (let Parse_shen.<expr> (shen.<expr> V1700) (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> V1700) (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> (V1705) (let Result (let Parse_shen.<expr> (shen.<expr> V1705) (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> (V1710) (let Result (if (cons? (hd V1710)) (let Parse_X (hd (hd V1710)) (if (shen.doubleunderline? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1710)) (shen.hdtl V1710))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
88
88
|
|
89
|
-
(defun shen.<singleunderline> (
|
89
|
+
(defun shen.<singleunderline> (V1715) (let Result (if (cons? (hd V1715)) (let Parse_X (hd (hd V1715)) (if (shen.singleunderline? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1715)) (shen.hdtl V1715))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result)))
|
90
90
|
|
91
|
-
(defun shen.singleunderline? (
|
91
|
+
(defun shen.singleunderline? (V1716) (and (symbol? V1716) (shen.sh? (str V1716))))
|
92
92
|
|
93
|
-
(defun shen.sh? (
|
93
|
+
(defun shen.sh? (V1717) (cond ((= "_" V1717) true) (true (and (= (pos V1717 0) "_") (shen.sh? (tlstr V1717))))))
|
94
94
|
|
95
|
-
(defun shen.doubleunderline? (
|
95
|
+
(defun shen.doubleunderline? (V1718) (and (symbol? V1718) (shen.dh? (str V1718))))
|
96
96
|
|
97
|
-
(defun shen.dh? (
|
97
|
+
(defun shen.dh? (V1719) (cond ((= "=" V1719) true) (true (and (= (pos V1719 0) "=") (shen.dh? (tlstr V1719))))))
|
98
98
|
|
99
|
-
(defun shen.process-datatype (
|
99
|
+
(defun shen.process-datatype (V1720 V1721) (shen.remember-datatype (shen.s-prolog (shen.rules->horn-clauses V1720 V1721))))
|
100
100
|
|
101
|
-
(defun shen.remember-datatype (
|
101
|
+
(defun shen.remember-datatype (V1726) (cond ((cons? V1726) (do (set shen.*datatypes* (adjoin (hd V1726) (value shen.*datatypes*))) (do (set shen.*alldatatypes* (adjoin (hd V1726) (value shen.*alldatatypes*))) (hd V1726)))) (true (shen.sys-error shen.remember-datatype))))
|
102
102
|
|
103
|
-
(defun shen.rules->horn-clauses (
|
103
|
+
(defun shen.rules->horn-clauses (V1729 V1730) (cond ((= () V1730) ()) ((and (cons? V1730) (and (tuple? (hd V1730)) (= shen.single (fst (hd V1730))))) (cons (shen.rule->horn-clause V1729 (snd (hd V1730))) (shen.rules->horn-clauses V1729 (tl V1730)))) ((and (cons? V1730) (and (tuple? (hd V1730)) (= shen.double (fst (hd V1730))))) (shen.rules->horn-clauses V1729 (append (shen.double->singles (snd (hd V1730))) (tl V1730)))) (true (shen.sys-error shen.rules->horn-clauses))))
|
104
104
|
|
105
|
-
(defun shen.double->singles (
|
105
|
+
(defun shen.double->singles (V1731) (cons (shen.right-rule V1731) (cons (shen.left-rule V1731) ())))
|
106
106
|
|
107
|
-
(defun shen.right-rule (
|
107
|
+
(defun shen.right-rule (V1732) (@p shen.single V1732))
|
108
108
|
|
109
|
-
(defun shen.left-rule (
|
109
|
+
(defun shen.left-rule (V1733) (cond ((and (cons? V1733) (and (cons? (tl V1733)) (and (cons? (tl (tl V1733))) (and (tuple? (hd (tl (tl V1733)))) (and (= () (fst (hd (tl (tl V1733))))) (= () (tl (tl (tl V1733))))))))) (let Q (gensym Qv) (let NewConclusion (@p (cons (snd (hd (tl (tl V1733)))) ()) Q) (let NewPremises (cons (@p (map shen.right->left (hd (tl V1733))) Q) ()) (@p shen.single (cons (hd V1733) (cons NewPremises (cons NewConclusion ())))))))) (true (shen.sys-error shen.left-rule))))
|
110
110
|
|
111
|
-
(defun shen.right->left (
|
111
|
+
(defun shen.right->left (V1738) (cond ((and (tuple? V1738) (= () (fst V1738))) (snd V1738)) (true (simple-error "syntax error with ==========
|
112
112
|
"))))
|
113
113
|
|
114
|
-
(defun shen.rule->horn-clause (
|
114
|
+
(defun shen.rule->horn-clause (V1739 V1740) (cond ((and (cons? V1740) (and (cons? (tl V1740)) (and (cons? (tl (tl V1740))) (and (tuple? (hd (tl (tl V1740)))) (= () (tl (tl (tl V1740)))))))) (cons (shen.rule->horn-clause-head V1739 (snd (hd (tl (tl V1740))))) (cons :- (cons (shen.rule->horn-clause-body (hd V1740) (hd (tl V1740)) (fst (hd (tl (tl V1740))))) ())))) (true (shen.sys-error shen.rule->horn-clause))))
|
115
115
|
|
116
|
-
(defun shen.rule->horn-clause-head (
|
116
|
+
(defun shen.rule->horn-clause-head (V1741 V1742) (cons V1741 (cons (shen.mode-ify V1742) (cons Context_1957 ()))))
|
117
117
|
|
118
|
-
(defun shen.mode-ify (
|
118
|
+
(defun shen.mode-ify (V1743) (cond ((and (cons? V1743) (and (cons? (tl V1743)) (and (= : (hd (tl V1743))) (and (cons? (tl (tl V1743))) (= () (tl (tl (tl V1743)))))))) (cons mode (cons (cons (hd V1743) (cons : (cons (cons mode (cons (hd (tl (tl V1743))) (cons + ()))) ()))) (cons - ())))) (true V1743)))
|
119
119
|
|
120
|
-
(defun shen.rule->horn-clause-body (
|
120
|
+
(defun shen.rule->horn-clause-body (V1744 V1745 V1746) (let Variables (map shen.extract_vars V1746) (let Predicates (map (lambda X (gensym shen.cl)) V1746) (let SearchLiterals (shen.construct-search-literals Predicates Variables Context_1957 Context1_1957) (let SearchClauses (shen.construct-search-clauses Predicates V1746 Variables) (let SideLiterals (shen.construct-side-literals V1744) (let PremissLiterals (map (lambda X (shen.construct-premiss-literal X (empty? V1746))) V1745) (append SearchLiterals (append SideLiterals PremissLiterals)))))))))
|
121
121
|
|
122
|
-
(defun shen.construct-search-literals (
|
122
|
+
(defun shen.construct-search-literals (V1751 V1752 V1753 V1754) (cond ((and (= () V1751) (= () V1752)) ()) (true (shen.csl-help V1751 V1752 V1753 V1754))))
|
123
123
|
|
124
|
-
(defun shen.csl-help (
|
124
|
+
(defun shen.csl-help (V1757 V1758 V1759 V1760) (cond ((and (= () V1757) (= () V1758)) (cons (cons bind (cons ContextOut_1957 (cons V1759 ()))) ())) ((and (cons? V1757) (cons? V1758)) (cons (cons (hd V1757) (cons V1759 (cons V1760 (hd V1758)))) (shen.csl-help (tl V1757) (tl V1758) V1760 (gensym Context)))) (true (shen.sys-error shen.csl-help))))
|
125
125
|
|
126
|
-
(defun shen.construct-search-clauses (
|
126
|
+
(defun shen.construct-search-clauses (V1761 V1762 V1763) (cond ((and (= () V1761) (and (= () V1762) (= () V1763))) shen.skip) ((and (cons? V1761) (and (cons? V1762) (cons? V1763))) (do (shen.construct-search-clause (hd V1761) (hd V1762) (hd V1763)) (shen.construct-search-clauses (tl V1761) (tl V1762) (tl V1763)))) (true (shen.sys-error shen.construct-search-clauses))))
|
127
127
|
|
128
|
-
(defun shen.construct-search-clause (
|
128
|
+
(defun shen.construct-search-clause (V1764 V1765 V1766) (shen.s-prolog (cons (shen.construct-base-search-clause V1764 V1765 V1766) (cons (shen.construct-recursive-search-clause V1764 V1765 V1766) ()))))
|
129
129
|
|
130
|
-
(defun shen.construct-base-search-clause (
|
130
|
+
(defun shen.construct-base-search-clause (V1767 V1768 V1769) (cons (cons V1767 (cons (cons (shen.mode-ify V1768) In_1957) (cons In_1957 V1769))) (cons :- (cons () ()))))
|
131
131
|
|
132
|
-
(defun shen.construct-recursive-search-clause (
|
132
|
+
(defun shen.construct-recursive-search-clause (V1770 V1771 V1772) (cons (cons V1770 (cons (cons Assumption_1957 Assumptions_1957) (cons (cons Assumption_1957 Out_1957) V1772))) (cons :- (cons (cons (cons V1770 (cons Assumptions_1957 (cons Out_1957 V1772))) ()) ()))))
|
133
133
|
|
134
|
-
(defun shen.construct-side-literals (
|
134
|
+
(defun shen.construct-side-literals (V1777) (cond ((= () V1777) ()) ((and (cons? V1777) (and (cons? (hd V1777)) (and (= if (hd (hd V1777))) (and (cons? (tl (hd V1777))) (= () (tl (tl (hd V1777)))))))) (cons (cons when (tl (hd V1777))) (shen.construct-side-literals (tl V1777)))) ((and (cons? V1777) (and (cons? (hd V1777)) (and (= let (hd (hd V1777))) (and (cons? (tl (hd V1777))) (and (cons? (tl (tl (hd V1777)))) (= () (tl (tl (tl (hd V1777)))))))))) (cons (cons is (tl (hd V1777))) (shen.construct-side-literals (tl V1777)))) ((cons? V1777) (shen.construct-side-literals (tl V1777))) (true (shen.sys-error shen.construct-side-literals))))
|
135
135
|
|
136
|
-
(defun shen.construct-premiss-literal (
|
136
|
+
(defun shen.construct-premiss-literal (V1782 V1783) (cond ((tuple? V1782) (cons shen.t* (cons (shen.recursive_cons_form (snd V1782)) (cons (shen.construct-context V1783 (fst V1782)) ())))) ((= ! V1782) (cons cut (cons Throwcontrol ()))) (true (shen.sys-error shen.construct-premiss-literal))))
|
137
137
|
|
138
|
-
(defun shen.construct-context (
|
138
|
+
(defun shen.construct-context (V1784 V1785) (cond ((and (= true V1784) (= () V1785)) Context_1957) ((and (= false V1784) (= () V1785)) ContextOut_1957) ((cons? V1785) (cons cons (cons (shen.recursive_cons_form (hd V1785)) (cons (shen.construct-context V1784 (tl V1785)) ())))) (true (shen.sys-error shen.construct-context))))
|
139
139
|
|
140
|
-
(defun shen.recursive_cons_form (
|
140
|
+
(defun shen.recursive_cons_form (V1786) (cond ((cons? V1786) (cons cons (cons (shen.recursive_cons_form (hd V1786)) (cons (shen.recursive_cons_form (tl V1786)) ())))) (true V1786)))
|
141
141
|
|
142
|
-
(defun preclude (
|
142
|
+
(defun preclude (V1787) (shen.preclude-h (map shen.intern-type V1787)))
|
143
143
|
|
144
|
-
(defun shen.preclude-h (
|
144
|
+
(defun shen.preclude-h (V1788) (let FilterDatatypes (set shen.*datatypes* (difference (value shen.*datatypes*) V1788)) (value shen.*datatypes*)))
|
145
145
|
|
146
|
-
(defun include (
|
146
|
+
(defun include (V1789) (shen.include-h (map shen.intern-type V1789)))
|
147
147
|
|
148
|
-
(defun shen.include-h (
|
148
|
+
(defun shen.include-h (V1790) (let ValidTypes (intersection V1790 (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 (V1791) (shen.preclude-h (difference (value shen.*alldatatypes*) (map shen.intern-type V1791))))
|
151
151
|
|
152
|
-
(defun include-all-but (
|
152
|
+
(defun include-all-but (V1792) (shen.include-h (difference (value shen.*alldatatypes*) (map shen.intern-type V1792))))
|
153
153
|
|
154
|
-
(defun shen.synonyms-help (
|
154
|
+
(defun shen.synonyms-help (V1797) (cond ((= () V1797) synonyms) ((and (cons? V1797) (cons? (tl V1797))) (do (shen.pushnew (cons (hd V1797) (shen.curry-type (hd (tl V1797)))) shen.*synonyms*) (shen.synonyms-help (tl (tl V1797))))) (true (simple-error (cn "odd number of synonyms
|
155
155
|
" "")))))
|
156
156
|
|
157
|
-
(defun shen.pushnew (
|
157
|
+
(defun shen.pushnew (V1798 V1799) (if (element? V1798 (value V1799)) (value V1799) (set V1799 (cons V1798 (value V1799)))))
|
158
158
|
|
159
159
|
|
160
160
|
|
@@ -47,211 +47,195 @@
|
|
47
47
|
* explains this license in full. *
|
48
48
|
* *
|
49
49
|
*****************************************************************************************
|
50
|
-
"(defun thaw (
|
50
|
+
"(defun thaw (V1802) (V1802))
|
51
51
|
|
52
|
-
(defun eval (
|
52
|
+
(defun eval (V1803) (let Macroexpand (shen.walk (lambda V1800 (macroexpand V1800)) V1803) (if (shen.packaged? Macroexpand) (map shen.eval-without-macros (shen.package-contents Macroexpand)) (shen.eval-without-macros Macroexpand))))
|
53
53
|
|
54
|
-
(defun shen.eval-without-macros (
|
54
|
+
(defun shen.eval-without-macros (V1804) (eval-kl (shen.elim-def (shen.proc-input+ V1804))))
|
55
55
|
|
56
|
-
(defun shen.proc-input+ (
|
56
|
+
(defun shen.proc-input+ (V1805) (cond ((and (cons? V1805) (and (= input+ (hd V1805)) (and (cons? (tl V1805)) (and (cons? (tl (tl V1805))) (= () (tl (tl (tl V1805)))))))) (cons input+ (cons (shen.rcons_form (hd (tl V1805))) (tl (tl V1805))))) ((and (cons? V1805) (and (= read+ (hd V1805)) (and (cons? (tl V1805)) (and (cons? (tl (tl V1805))) (= () (tl (tl (tl V1805)))))))) (cons read+ (cons (shen.rcons_form (hd (tl V1805))) (tl (tl V1805))))) ((cons? V1805) (map shen.proc-input+ V1805)) (true V1805)))
|
57
57
|
|
58
|
-
(defun shen.elim-def (
|
58
|
+
(defun shen.elim-def (V1806) (cond ((and (cons? V1806) (and (= define (hd V1806)) (cons? (tl V1806)))) (shen.shen->kl (hd (tl V1806)) (tl (tl V1806)))) ((and (cons? V1806) (and (= defmacro (hd V1806)) (cons? (tl V1806)))) (let Default (cons X (cons -> (cons X ()))) (let Def (shen.elim-def (cons define (cons (hd (tl V1806)) (append (tl (tl V1806)) Default)))) (let MacroAdd (shen.add-macro (hd (tl V1806))) Def)))) ((and (cons? V1806) (and (= defcc (hd V1806)) (cons? (tl V1806)))) (shen.elim-def (shen.yacc V1806))) ((cons? V1806) (map shen.elim-def V1806)) (true V1806)))
|
59
59
|
|
60
|
-
(defun shen.add-macro (
|
60
|
+
(defun shen.add-macro (V1807) (set *macros* (adjoin V1807 (value *macros*))))
|
61
61
|
|
62
|
-
(defun shen.packaged? (
|
62
|
+
(defun shen.packaged? (V1814) (cond ((and (cons? V1814) (and (= package (hd V1814)) (and (cons? (tl V1814)) (cons? (tl (tl V1814)))))) true) (true false)))
|
63
63
|
|
64
|
-
(defun external (
|
64
|
+
(defun external (V1815) (trap-error (get V1815 shen.external-symbols (value *property-vector*)) (lambda E (simple-error (cn "package " (shen.app V1815 " has not been used.
|
65
65
|
" shen.a))))))
|
66
66
|
|
67
|
-
(defun shen.package-contents (
|
67
|
+
(defun shen.package-contents (V1818) (cond ((and (cons? V1818) (and (= package (hd V1818)) (and (cons? (tl V1818)) (and (= null (hd (tl V1818))) (cons? (tl (tl V1818))))))) (tl (tl (tl V1818)))) ((and (cons? V1818) (and (= package (hd V1818)) (and (cons? (tl V1818)) (cons? (tl (tl V1818)))))) (shen.packageh (hd (tl V1818)) (hd (tl (tl V1818))) (tl (tl (tl V1818))))) (true (shen.sys-error shen.package-contents))))
|
68
68
|
|
69
|
-
(defun shen.walk (
|
69
|
+
(defun shen.walk (V1819 V1820) (cond ((cons? V1820) (V1819 (map (lambda Z (shen.walk V1819 Z)) V1820))) (true (V1819 V1820))))
|
70
70
|
|
71
|
-
(defun compile (
|
71
|
+
(defun compile (V1821 V1822 V1823) (let O (V1821 (cons V1822 (cons () ()))) (if (or (= (fail) O) (not (empty? (hd O)))) (V1823 O) (shen.hdtl O))))
|
72
72
|
|
73
|
-
(defun fail-if (
|
73
|
+
(defun fail-if (V1824 V1825) (if (V1824 V1825) (fail) V1825))
|
74
74
|
|
75
|
-
(defun @s (
|
75
|
+
(defun @s (V1826 V1827) (cn V1826 V1827))
|
76
76
|
|
77
77
|
(defun tc? () (value shen.*tc*))
|
78
78
|
|
79
|
-
(defun ps (
|
79
|
+
(defun ps (V1828) (trap-error (get V1828 shen.source (value *property-vector*)) (lambda E (simple-error (shen.app V1828 " not found.
|
80
80
|
" shen.a)))))
|
81
81
|
|
82
82
|
(defun stinput () (value *stinput*))
|
83
83
|
|
84
|
-
(defun shen.+vector? (
|
84
|
+
(defun shen.+vector? (V1829) (and (absvector? V1829) (> (<-address V1829 0) 0)))
|
85
85
|
|
86
|
-
(defun vector (
|
86
|
+
(defun vector (V1830) (let Vector (absvector (+ V1830 1)) (let ZeroStamp (address-> Vector 0 V1830) (let Standard (if (= V1830 0) ZeroStamp (shen.fillvector ZeroStamp 1 V1830 (fail))) Standard))))
|
87
87
|
|
88
|
-
(defun shen.fillvector (
|
88
|
+
(defun shen.fillvector (V1831 V1832 V1833 V1834) (cond ((= V1833 V1832) (address-> V1831 V1833 V1834)) (true (shen.fillvector (address-> V1831 V1832 V1834) (+ 1 V1832) V1833 V1834))))
|
89
89
|
|
90
|
-
(defun vector? (
|
90
|
+
(defun vector? (V1836) (and (absvector? V1836) (trap-error (>= (<-address V1836 0) 0) (lambda E false))))
|
91
91
|
|
92
|
-
(defun vector-> (
|
93
|
-
") (address->
|
92
|
+
(defun vector-> (V1837 V1838 V1839) (if (= V1838 0) (simple-error "cannot access 0th element of a vector
|
93
|
+
") (address-> V1837 V1838 V1839)))
|
94
94
|
|
95
|
-
(defun <-vector (
|
96
|
-
") (let VectorElement (<-address
|
95
|
+
(defun <-vector (V1840 V1841) (if (= V1841 0) (simple-error "cannot access 0th element of a vector
|
96
|
+
") (let VectorElement (<-address V1840 V1841) (if (= VectorElement (fail)) (simple-error "vector element not found
|
97
97
|
") VectorElement))))
|
98
98
|
|
99
|
-
(defun shen.posint? (
|
99
|
+
(defun shen.posint? (V1842) (and (integer? V1842) (>= V1842 0)))
|
100
100
|
|
101
|
-
(defun limit (
|
101
|
+
(defun limit (V1843) (<-address V1843 0))
|
102
102
|
|
103
|
-
(defun symbol? (
|
103
|
+
(defun symbol? (V1844) (cond ((or (boolean? V1844) (or (number? V1844) (string? V1844))) false) (true (trap-error (let String (str V1844) (shen.analyse-symbol? String)) (lambda E false)))))
|
104
104
|
|
105
|
-
(defun shen.analyse-symbol? (
|
105
|
+
(defun shen.analyse-symbol? (V1845) (cond ((shen.+string? V1845) (and (shen.alpha? (pos V1845 0)) (shen.alphanums? (tlstr V1845)))) (true (shen.sys-error shen.analyse-symbol?))))
|
106
106
|
|
107
|
-
(defun shen.alpha? (
|
107
|
+
(defun shen.alpha? (V1846) (element? V1846 (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? (V1847) (cond ((= "" V1847) true) ((shen.+string? V1847) (and (shen.alphanum? (pos V1847 0)) (shen.alphanums? (tlstr V1847)))) (true (shen.sys-error shen.alphanums?))))
|
110
110
|
|
111
|
-
(defun shen.alphanum? (
|
111
|
+
(defun shen.alphanum? (V1848) (or (shen.alpha? V1848) (shen.digit? V1848)))
|
112
112
|
|
113
|
-
(defun shen.digit? (
|
113
|
+
(defun shen.digit? (V1849) (element? V1849 (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? (V1850) (cond ((or (boolean? V1850) (or (number? V1850) (string? V1850))) false) (true (trap-error (let String (str V1850) (shen.analyse-variable? String)) (lambda E false)))))
|
116
116
|
|
117
|
-
(defun shen.analyse-variable? (
|
117
|
+
(defun shen.analyse-variable? (V1851) (cond ((shen.+string? V1851) (and (shen.uppercase? (pos V1851 0)) (shen.alphanums? (tlstr V1851)))) (true (shen.sys-error shen.analyse-variable?))))
|
118
118
|
|
119
|
-
(defun shen.uppercase? (
|
119
|
+
(defun shen.uppercase? (V1852) (element? V1852 (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 (V1853) (concat V1853 (set shen.*gensym* (+ 1 (value shen.*gensym*)))))
|
122
122
|
|
123
|
-
(defun concat (
|
123
|
+
(defun concat (V1854 V1855) (intern (cn (str V1854) (str V1855))))
|
124
124
|
|
125
|
-
(defun @p (
|
125
|
+
(defun @p (V1856 V1857) (let Vector (absvector 3) (let Tag (address-> Vector 0 shen.tuple) (let Fst (address-> Vector 1 V1856) (let Snd (address-> Vector 2 V1857) Vector)))))
|
126
126
|
|
127
|
-
(defun fst (
|
127
|
+
(defun fst (V1858) (<-address V1858 1))
|
128
128
|
|
129
|
-
(defun snd (
|
129
|
+
(defun snd (V1859) (<-address V1859 2))
|
130
130
|
|
131
|
-
(defun tuple? (
|
131
|
+
(defun tuple? (V1860) (trap-error (and (absvector? V1860) (= shen.tuple (<-address V1860 0))) (lambda E false)))
|
132
132
|
|
133
|
-
(defun append (
|
133
|
+
(defun append (V1861 V1862) (cond ((= () V1861) V1862) ((cons? V1861) (cons (hd V1861) (append (tl V1861) V1862))) (true (shen.sys-error append))))
|
134
134
|
|
135
|
-
(defun @v (
|
135
|
+
(defun @v (V1863 V1864) (let Limit (limit V1864) (let NewVector (vector (+ Limit 1)) (let X+NewVector (vector-> NewVector 1 V1863) (if (= Limit 0) X+NewVector (shen.@v-help V1864 1 Limit X+NewVector))))))
|
136
136
|
|
137
|
-
(defun shen.@v-help (
|
137
|
+
(defun shen.@v-help (V1865 V1866 V1867 V1868) (cond ((= V1867 V1866) (shen.copyfromvector V1865 V1868 V1867 (+ V1867 1))) (true (shen.@v-help V1865 (+ V1866 1) V1867 (shen.copyfromvector V1865 V1868 V1866 (+ V1866 1))))))
|
138
138
|
|
139
|
-
(defun shen.copyfromvector (
|
139
|
+
(defun shen.copyfromvector (V1870 V1871 V1872 V1873) (trap-error (vector-> V1871 V1873 (<-vector V1870 V1872)) (lambda E V1871)))
|
140
140
|
|
141
|
-
(defun hdv (
|
141
|
+
(defun hdv (V1874) (trap-error (<-vector V1874 1) (lambda E (simple-error (cn "hdv needs a non-empty vector as an argument; not " (shen.app V1874 "
|
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 (V1875) (let Limit (limit V1875) (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 V1875 2 Limit (vector (- Limit 1))))))))
|
146
146
|
|
147
|
-
(defun shen.tlv-help (
|
147
|
+
(defun shen.tlv-help (V1876 V1877 V1878 V1879) (cond ((= V1878 V1877) (shen.copyfromvector V1876 V1879 V1878 (- V1878 1))) (true (shen.tlv-help V1876 (+ V1877 1) V1878 (shen.copyfromvector V1876 V1879 V1877 (- V1877 1))))))
|
148
148
|
|
149
|
-
(defun assoc (
|
149
|
+
(defun assoc (V1889 V1890) (cond ((= () V1890) ()) ((and (cons? V1890) (and (cons? (hd V1890)) (= (hd (hd V1890)) V1889))) (hd V1890)) ((cons? V1890) (assoc V1889 (tl V1890))) (true (shen.sys-error assoc))))
|
150
150
|
|
151
|
-
(defun boolean? (
|
151
|
+
(defun boolean? (V1896) (cond ((= true V1896) true) ((= false V1896) true) (true false)))
|
152
152
|
|
153
|
-
(defun nl (
|
154
|
-
" (stoutput)) (nl (-
|
153
|
+
(defun nl (V1897) (cond ((= 0 V1897) 0) (true (do (shen.prhush "
|
154
|
+
" (stoutput)) (nl (- V1897 1))))))
|
155
155
|
|
156
|
-
(defun difference (
|
156
|
+
(defun difference (V1900 V1901) (cond ((= () V1900) ()) ((cons? V1900) (if (element? (hd V1900) V1901) (difference (tl V1900) V1901) (cons (hd V1900) (difference (tl V1900) V1901)))) (true (shen.sys-error difference))))
|
157
157
|
|
158
|
-
(defun do (
|
158
|
+
(defun do (V1902 V1903) V1903)
|
159
159
|
|
160
|
-
(defun element? (
|
160
|
+
(defun element? (V1912 V1913) (cond ((= () V1913) false) ((and (cons? V1913) (= (hd V1913) V1912)) true) ((cons? V1913) (element? V1912 (tl V1913))) (true (shen.sys-error element?))))
|
161
161
|
|
162
|
-
(defun empty? (
|
162
|
+
(defun empty? (V1919) (cond ((= () V1919) true) (true false)))
|
163
163
|
|
164
|
-
(defun fix (
|
164
|
+
(defun fix (V1920 V1921) (shen.fix-help V1920 V1921 (V1920 V1921)))
|
165
165
|
|
166
|
-
(defun shen.fix-help (
|
166
|
+
(defun shen.fix-help (V1928 V1929 V1930) (cond ((= V1930 V1929) V1930) (true (shen.fix-help V1928 V1930 (V1928 V1930)))))
|
167
167
|
|
168
|
-
(defun put (
|
168
|
+
(defun put (V1932 V1933 V1934 V1935) (let N (hash V1932 (limit V1935)) (let Entry (trap-error (<-vector V1935 N) (lambda E ())) (let Change (vector-> V1935 N (shen.change-pointer-value V1932 V1933 V1934 Entry)) V1934))))
|
169
169
|
|
170
|
-
(defun shen.change-pointer-value (
|
170
|
+
(defun shen.change-pointer-value (V1938 V1939 V1940 V1941) (cond ((= () V1941) (cons (cons (cons V1938 (cons V1939 ())) V1940) ())) ((and (cons? V1941) (and (cons? (hd V1941)) (and (cons? (hd (hd V1941))) (and (cons? (tl (hd (hd V1941)))) (and (= () (tl (tl (hd (hd V1941))))) (and (= (hd (tl (hd (hd V1941)))) V1939) (= (hd (hd (hd V1941))) V1938))))))) (cons (cons (hd (hd V1941)) V1940) (tl V1941))) ((cons? V1941) (cons (hd V1941) (shen.change-pointer-value V1938 V1939 V1940 (tl V1941)))) (true (shen.sys-error shen.change-pointer-value))))
|
171
171
|
|
172
|
-
(defun get (
|
173
|
-
"))) (let Result (assoc (cons
|
172
|
+
(defun get (V1944 V1945 V1946) (let N (hash V1944 (limit V1946)) (let Entry (trap-error (<-vector V1946 N) (lambda E (simple-error "pointer not found
|
173
|
+
"))) (let Result (assoc (cons V1944 (cons V1945 ())) Entry) (if (empty? Result) (simple-error "value not found
|
174
174
|
") (tl Result))))))
|
175
175
|
|
176
|
-
(defun hash (
|
176
|
+
(defun hash (V1947 V1948) (let Hash (shen.mod (shen.sum (map (lambda V1801 (string->n V1801)) (explode V1947))) V1948) (if (= 0 Hash) 1 Hash)))
|
177
177
|
|
178
|
-
(defun shen.mod (
|
178
|
+
(defun shen.mod (V1949 V1950) (shen.modh V1949 (shen.multiples V1949 (cons V1950 ()))))
|
179
179
|
|
180
|
-
(defun shen.multiples (
|
180
|
+
(defun shen.multiples (V1951 V1952) (cond ((and (cons? V1952) (> (hd V1952) V1951)) (tl V1952)) ((cons? V1952) (shen.multiples V1951 (cons (* 2 (hd V1952)) V1952))) (true (shen.sys-error shen.multiples))))
|
181
181
|
|
182
|
-
(defun shen.modh (
|
182
|
+
(defun shen.modh (V1955 V1956) (cond ((= 0 V1955) 0) ((= () V1956) V1955) ((and (cons? V1956) (> (hd V1956) V1955)) (if (empty? (tl V1956)) V1955 (shen.modh V1955 (tl V1956)))) ((cons? V1956) (shen.modh (- V1955 (hd V1956)) V1956)) (true (shen.sys-error shen.modh))))
|
183
183
|
|
184
|
-
(defun shen.sum (
|
184
|
+
(defun shen.sum (V1957) (cond ((= () V1957) 0) ((cons? V1957) (+ (hd V1957) (shen.sum (tl V1957)))) (true (shen.sys-error shen.sum))))
|
185
185
|
|
186
|
-
(defun head (
|
186
|
+
(defun head (V1964) (cond ((cons? V1964) (hd V1964)) (true (simple-error "head expects a non-empty list"))))
|
187
187
|
|
188
|
-
(defun tail (
|
188
|
+
(defun tail (V1971) (cond ((cons? V1971) (tl V1971)) (true (simple-error "tail expects a non-empty list"))))
|
189
189
|
|
190
|
-
(defun hdstr (
|
190
|
+
(defun hdstr (V1972) (pos V1972 0))
|
191
191
|
|
192
|
-
(defun intersection (
|
192
|
+
(defun intersection (V1975 V1976) (cond ((= () V1975) ()) ((cons? V1975) (if (element? (hd V1975) V1976) (cons (hd V1975) (intersection (tl V1975) V1976)) (intersection (tl V1975) V1976))) (true (shen.sys-error intersection))))
|
193
193
|
|
194
|
-
(defun reverse (
|
194
|
+
(defun reverse (V1977) (shen.reverse_help V1977 ()))
|
195
195
|
|
196
|
-
(defun shen.reverse_help (
|
196
|
+
(defun shen.reverse_help (V1978 V1979) (cond ((= () V1978) V1979) ((cons? V1978) (shen.reverse_help (tl V1978) (cons (hd V1978) V1979))) (true (shen.sys-error shen.reverse_help))))
|
197
197
|
|
198
|
-
(defun union (
|
198
|
+
(defun union (V1980 V1981) (cond ((= () V1980) V1981) ((cons? V1980) (if (element? (hd V1980) V1981) (union (tl V1980) V1981) (cons (hd V1980) (union (tl V1980) V1981)))) (true (shen.sys-error union))))
|
199
199
|
|
200
|
-
(defun y-or-n? (
|
201
|
-
" (stoutput)) (y-or-n?
|
200
|
+
(defun y-or-n? (V1982) (let Message (shen.prhush (shen.proc-nl V1982) (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? V1982))))))))
|
202
202
|
|
203
|
-
(defun not (
|
203
|
+
(defun not (V1983) (if V1983 false true))
|
204
204
|
|
205
|
-
(defun subst (
|
205
|
+
(defun subst (V1992 V1993 V1994) (cond ((= V1994 V1993) V1992) ((cons? V1994) (cons (subst V1992 V1993 (hd V1994)) (subst V1992 V1993 (tl V1994)))) (true V1994)))
|
206
206
|
|
207
|
-
(defun explode (
|
207
|
+
(defun explode (V1996) (shen.explode-h (shen.app V1996 "" shen.a)))
|
208
208
|
|
209
|
-
(defun shen.explode-h (
|
209
|
+
(defun shen.explode-h (V1997) (cond ((= "" V1997) ()) ((shen.+string? V1997) (cons (pos V1997 0) (shen.explode-h (tlstr V1997)))) (true (shen.sys-error shen.explode-h))))
|
210
210
|
|
211
|
-
(defun cd (
|
211
|
+
(defun cd (V1998) (set *home-directory* (if (= V1998 "") "" (shen.app V1998 "/" shen.a))))
|
212
212
|
|
213
|
-
(defun map (
|
213
|
+
(defun map (V1999 V2000) (shen.map-h V1999 V2000 ()))
|
214
214
|
|
215
|
-
(defun shen.map-h (
|
215
|
+
(defun shen.map-h (V2003 V2004 V2005) (cond ((= () V2004) (reverse V2005)) ((cons? V2004) (shen.map-h V2003 (tl V2004) (cons (V2003 (hd V2004)) V2005))) (true (shen.sys-error shen.map-h))))
|
216
216
|
|
217
|
-
(defun length (
|
217
|
+
(defun length (V2006) (shen.length-h V2006 0))
|
218
218
|
|
219
|
-
(defun shen.length-h (
|
219
|
+
(defun shen.length-h (V2007 V2008) (cond ((= () V2007) V2008) (true (shen.length-h (tl V2007) (+ V2008 1)))))
|
220
220
|
|
221
|
-
(defun occurrences (
|
221
|
+
(defun occurrences (V2017 V2018) (cond ((= V2018 V2017) 1) ((cons? V2018) (+ (occurrences V2017 (hd V2018)) (occurrences V2017 (tl V2018)))) (true 0)))
|
222
222
|
|
223
|
-
(defun nth (
|
223
|
+
(defun nth (V2026 V2027) (cond ((and (= 1 V2026) (cons? V2027)) (hd V2027)) ((cons? V2027) (nth (- V2026 1) (tl V2027))) (true (shen.sys-error nth))))
|
224
224
|
|
225
|
-
(defun integer? (
|
225
|
+
(defun integer? (V2028) (and (number? V2028) (let Abs (shen.abs V2028) (shen.integer-test? Abs (shen.magless Abs 1)))))
|
226
226
|
|
227
|
-
(defun shen.abs (
|
227
|
+
(defun shen.abs (V2029) (if (> V2029 0) V2029 (- 0 V2029)))
|
228
228
|
|
229
|
-
(defun shen.magless (
|
229
|
+
(defun shen.magless (V2030 V2031) (let Nx2 (* V2031 2) (if (> Nx2 V2030) V2031 (shen.magless V2030 Nx2))))
|
230
230
|
|
231
|
-
(defun shen.integer-test? (
|
231
|
+
(defun shen.integer-test? (V2035 V2036) (cond ((= 0 V2035) true) ((> 1 V2035) false) (true (let Abs-N (- V2035 V2036) (if (> 0 Abs-N) (integer? V2035) (shen.integer-test? Abs-N V2036))))))
|
232
232
|
|
233
|
-
(defun mapcan (
|
233
|
+
(defun mapcan (V2039 V2040) (cond ((= () V2040) ()) ((cons? V2040) (append (V2039 (hd V2040)) (mapcan V2039 (tl V2040)))) (true (shen.sys-error mapcan))))
|
234
234
|
|
235
|
-
(defun
|
236
|
-
|
237
|
-
(defun shen.read-file-as-bytelist-help (V2022 V2023 V2024) (cond ((= -1 V2023) V2024) (true (shen.read-file-as-bytelist-help V2022 (read-byte V2022) (cons V2023 V2024)))))
|
238
|
-
|
239
|
-
(defun read-file-as-string (V2025) (let Stream (open file V2025 in) (shen.rfas-h Stream (read-byte Stream) "")))
|
240
|
-
|
241
|
-
(defun shen.rfas-h (V2026 V2027 V2028) (cond ((= -1 V2027) (do (close V2026) V2028)) (true (shen.rfas-h V2026 (read-byte V2026) (cn V2028 (n->string V2027))))))
|
242
|
-
|
243
|
-
(defun == (V2037 V2038) (cond ((= V2038 V2037) true) (true false)))
|
235
|
+
(defun == (V2049 V2050) (cond ((= V2050 V2049) true) (true false)))
|
244
236
|
|
245
237
|
(defun abort () (simple-error ""))
|
246
238
|
|
247
|
-
(defun read () (hd (lineread)))
|
248
|
-
|
249
|
-
(defun input () (eval (read)))
|
250
|
-
|
251
|
-
(defun input+ (V2044 V2045) (let Input (read) (let Check (shen.typecheck Input V2045) (if (= false Check) (do (shen.prhush (cn "input is not of type " (shen.app V2045 ": please re-enter " shen.r)) (stoutput)) (input+ : V2045)) (eval Input)))))
|
252
|
-
|
253
|
-
(defun read+ (V2050 V2051) (let Input (read) (let Check (shen.typecheck (shen.rcons_form Input) V2051) (if (= false Check) (do (shen.prhush (cn "input is not of type " (shen.app V2051 ": please re-enter " shen.r)) (stoutput)) (read+ : V2051)) Input))))
|
254
|
-
|
255
239
|
(defun bound? (V2052) (and (symbol? V2052) (let Val (trap-error (value V2052) (lambda E shen.this-symbol-is-unbound)) (if (= Val shen.this-symbol-is-unbound) false true))))
|
256
240
|
|
257
241
|
(defun shen.string->bytes (V2053) (cond ((= "" V2053) ()) (true (cons (string->n (pos V2053 0)) (shen.string->bytes (tlstr V2053))))))
|