shen-ruby 0.13.0 → 0.14.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 +7 -0
- data/README.md +5 -5
- data/Rakefile +10 -3
- data/lib/shen_ruby/version.rb +1 -1
- data/shen-ruby.gemspec +2 -2
- data/shen/release/klambda/core.kl +63 -63
- data/shen/release/klambda/declarations.kl +7 -7
- data/shen/release/klambda/load.kl +15 -15
- data/shen/release/klambda/macros.kl +33 -33
- data/shen/release/klambda/prolog.kl +97 -97
- data/shen/release/klambda/reader.kl +83 -83
- data/shen/release/klambda/sequent.kl +55 -55
- data/shen/release/klambda/sys.kl +101 -101
- data/shen/release/klambda/t-star.kl +41 -41
- data/shen/release/klambda/toplevel.kl +21 -21
- data/shen/release/klambda/track.kl +25 -25
- data/shen/release/klambda/types.kl +4 -4
- data/shen/release/klambda/writer.kl +25 -25
- data/shen/release/klambda/yacc.kl +28 -28
- data/shen/release/license.pdf +0 -0
- data/shen/release/test_programs/bubble_version_2.shen +1 -1
- data/shen/release/test_programs/depth_.shen +1 -1
- data/shen/release/test_programs/interpreter.shen +1 -1
- data/shen/release/test_programs/metaprog.shen +1 -1
- data/shen/release/test_programs/semantic_net.shen +1 -1
- data/shen/release/test_programs/tests.shen +12 -12
- metadata +5 -5
@@ -23,118 +23,118 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
23
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
24
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
25
25
|
|
26
|
-
(defun shen.datatype-error (
|
26
|
+
(defun shen.datatype-error (V1370) (cond ((and (cons? V1370) (and (cons? (tl V1370)) (= () (tl (tl V1370))))) (simple-error (cn "datatype syntax error here:
|
27
27
|
|
28
|
-
" (shen.app (shen.next-50 50 (hd
|
28
|
+
" (shen.app (shen.next-50 50 (hd V1370)) "
|
29
29
|
" shen.a)))) (true (shen.f_error shen.datatype-error))))
|
30
30
|
|
31
|
-
(defun shen.<datatype-rules> (
|
31
|
+
(defun shen.<datatype-rules> (V1371) (let YaccParse (let Parse_shen.<datatype-rule> (shen.<datatype-rule> V1371) (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 (= YaccParse (fail)) (let Parse_<e> (<e> V1371) (if (not (= (fail) Parse_<e>)) (shen.pair (hd Parse_<e>) ()) (fail))) YaccParse)))
|
32
32
|
|
33
|
-
(defun shen.<datatype-rule> (
|
33
|
+
(defun shen.<datatype-rule> (V1372) (let YaccParse (let Parse_shen.<side-conditions> (shen.<side-conditions> V1372) (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 (= YaccParse (fail)) (let Parse_shen.<side-conditions> (shen.<side-conditions> V1372) (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))) YaccParse)))
|
34
34
|
|
35
|
-
(defun shen.<side-conditions> (
|
35
|
+
(defun shen.<side-conditions> (V1373) (let YaccParse (let Parse_shen.<side-condition> (shen.<side-condition> V1373) (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 (= YaccParse (fail)) (let Parse_<e> (<e> V1373) (if (not (= (fail) Parse_<e>)) (shen.pair (hd Parse_<e>) ()) (fail))) YaccParse)))
|
36
36
|
|
37
|
-
(defun shen.<side-condition> (
|
37
|
+
(defun shen.<side-condition> (V1374) (let YaccParse (if (and (cons? (hd V1374)) (= if (hd (hd V1374)))) (let Parse_shen.<expr> (shen.<expr> (shen.pair (tl (hd V1374)) (shen.hdtl V1374))) (if (not (= (fail) Parse_shen.<expr>)) (shen.pair (hd Parse_shen.<expr>) (cons if (cons (shen.hdtl Parse_shen.<expr>) ()))) (fail))) (fail)) (if (= YaccParse (fail)) (if (and (cons? (hd V1374)) (= let (hd (hd V1374)))) (let Parse_shen.<variable?> (shen.<variable?> (shen.pair (tl (hd V1374)) (shen.hdtl V1374))) (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)) YaccParse)))
|
38
38
|
|
39
|
-
(defun shen.<variable?> (
|
39
|
+
(defun shen.<variable?> (V1375) (if (cons? (hd V1375)) (let Parse_X (hd (hd V1375)) (if (variable? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1375)) (shen.hdtl V1375))) Parse_X) (fail))) (fail)))
|
40
40
|
|
41
|
-
(defun shen.<expr> (
|
41
|
+
(defun shen.<expr> (V1376) (if (cons? (hd V1376)) (let Parse_X (hd (hd V1376)) (if (not (or (element? Parse_X (cons >> (cons ; ()))) (or (shen.singleunderline? Parse_X) (shen.doubleunderline? Parse_X)))) (shen.pair (hd (shen.pair (tl (hd V1376)) (shen.hdtl V1376))) (shen.remove-bar Parse_X)) (fail))) (fail)))
|
42
42
|
|
43
|
-
(defun shen.remove-bar (
|
43
|
+
(defun shen.remove-bar (V1377) (cond ((and (cons? V1377) (and (cons? (tl V1377)) (and (cons? (tl (tl V1377))) (and (= () (tl (tl (tl V1377)))) (= (hd (tl V1377)) bar!))))) (cons (hd V1377) (hd (tl (tl V1377))))) ((cons? V1377) (cons (shen.remove-bar (hd V1377)) (shen.remove-bar (tl V1377)))) (true V1377)))
|
44
44
|
|
45
|
-
(defun shen.<premises> (
|
45
|
+
(defun shen.<premises> (V1378) (let YaccParse (let Parse_shen.<premise> (shen.<premise> V1378) (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 (= YaccParse (fail)) (let Parse_<e> (<e> V1378) (if (not (= (fail) Parse_<e>)) (shen.pair (hd Parse_<e>) ()) (fail))) YaccParse)))
|
46
46
|
|
47
|
-
(defun shen.<semicolon-symbol> (
|
47
|
+
(defun shen.<semicolon-symbol> (V1379) (if (cons? (hd V1379)) (let Parse_X (hd (hd V1379)) (if (= Parse_X ;) (shen.pair (hd (shen.pair (tl (hd V1379)) (shen.hdtl V1379))) shen.skip) (fail))) (fail)))
|
48
48
|
|
49
|
-
(defun shen.<premise> (
|
49
|
+
(defun shen.<premise> (V1380) (let YaccParse (if (and (cons? (hd V1380)) (= ! (hd (hd V1380)))) (shen.pair (hd (shen.pair (tl (hd V1380)) (shen.hdtl V1380))) !) (fail)) (if (= YaccParse (fail)) (let YaccParse (let Parse_shen.<formulae> (shen.<formulae> V1380) (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 (= YaccParse (fail)) (let Parse_shen.<formula> (shen.<formula> V1380) (if (not (= (fail) Parse_shen.<formula>)) (shen.pair (hd Parse_shen.<formula>) (shen.sequent () (shen.hdtl Parse_shen.<formula>))) (fail))) YaccParse)) YaccParse)))
|
50
50
|
|
51
|
-
(defun shen.<conclusion> (
|
51
|
+
(defun shen.<conclusion> (V1381) (let YaccParse (let Parse_shen.<formulae> (shen.<formulae> V1381) (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 (= YaccParse (fail)) (let Parse_shen.<formula> (shen.<formula> V1381) (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))) YaccParse)))
|
52
52
|
|
53
|
-
(defun shen.sequent (
|
53
|
+
(defun shen.sequent (V1382 V1383) (@p V1382 V1383))
|
54
54
|
|
55
|
-
(defun shen.<formulae> (
|
55
|
+
(defun shen.<formulae> (V1384) (let YaccParse (let Parse_shen.<formula> (shen.<formula> V1384) (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 (= YaccParse (fail)) (let YaccParse (let Parse_shen.<formula> (shen.<formula> V1384) (if (not (= (fail) Parse_shen.<formula>)) (shen.pair (hd Parse_shen.<formula>) (cons (shen.hdtl Parse_shen.<formula>) ())) (fail))) (if (= YaccParse (fail)) (let Parse_<e> (<e> V1384) (if (not (= (fail) Parse_<e>)) (shen.pair (hd Parse_<e>) ()) (fail))) YaccParse)) YaccParse)))
|
56
56
|
|
57
|
-
(defun shen.<comma-symbol> (
|
57
|
+
(defun shen.<comma-symbol> (V1385) (if (cons? (hd V1385)) (let Parse_X (hd (hd V1385)) (if (= Parse_X (intern ",")) (shen.pair (hd (shen.pair (tl (hd V1385)) (shen.hdtl V1385))) shen.skip) (fail))) (fail)))
|
58
58
|
|
59
|
-
(defun shen.<formula> (
|
59
|
+
(defun shen.<formula> (V1386) (let YaccParse (let Parse_shen.<expr> (shen.<expr> V1386) (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 (= YaccParse (fail)) (let Parse_shen.<expr> (shen.<expr> V1386) (if (not (= (fail) Parse_shen.<expr>)) (shen.pair (hd Parse_shen.<expr>) (shen.hdtl Parse_shen.<expr>)) (fail))) YaccParse)))
|
60
60
|
|
61
|
-
(defun shen.<type> (
|
61
|
+
(defun shen.<type> (V1387) (let Parse_shen.<expr> (shen.<expr> V1387) (if (not (= (fail) Parse_shen.<expr>)) (shen.pair (hd Parse_shen.<expr>) (shen.curry-type (shen.hdtl Parse_shen.<expr>))) (fail))))
|
62
62
|
|
63
|
-
(defun shen.<doubleunderline> (
|
63
|
+
(defun shen.<doubleunderline> (V1388) (if (cons? (hd V1388)) (let Parse_X (hd (hd V1388)) (if (shen.doubleunderline? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1388)) (shen.hdtl V1388))) Parse_X) (fail))) (fail)))
|
64
64
|
|
65
|
-
(defun shen.<singleunderline> (
|
65
|
+
(defun shen.<singleunderline> (V1389) (if (cons? (hd V1389)) (let Parse_X (hd (hd V1389)) (if (shen.singleunderline? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1389)) (shen.hdtl V1389))) Parse_X) (fail))) (fail)))
|
66
66
|
|
67
|
-
(defun shen.singleunderline? (
|
67
|
+
(defun shen.singleunderline? (V1390) (and (symbol? V1390) (shen.sh? (str V1390))))
|
68
68
|
|
69
|
-
(defun shen.sh? (
|
69
|
+
(defun shen.sh? (V1391) (cond ((= "_" V1391) true) (true (and (= (pos V1391 0) "_") (shen.sh? (tlstr V1391))))))
|
70
70
|
|
71
|
-
(defun shen.doubleunderline? (
|
71
|
+
(defun shen.doubleunderline? (V1392) (and (symbol? V1392) (shen.dh? (str V1392))))
|
72
72
|
|
73
|
-
(defun shen.dh? (
|
73
|
+
(defun shen.dh? (V1393) (cond ((= "=" V1393) true) (true (and (= (pos V1393 0) "=") (shen.dh? (tlstr V1393))))))
|
74
74
|
|
75
|
-
(defun shen.process-datatype (
|
75
|
+
(defun shen.process-datatype (V1394 V1395) (shen.remember-datatype (shen.s-prolog (shen.rules->horn-clauses V1394 V1395))))
|
76
76
|
|
77
|
-
(defun shen.remember-datatype (
|
77
|
+
(defun shen.remember-datatype (V1400) (cond ((cons? V1400) (do (set shen.*datatypes* (adjoin (hd V1400) (value shen.*datatypes*))) (do (set shen.*alldatatypes* (adjoin (hd V1400) (value shen.*alldatatypes*))) (hd V1400)))) (true (shen.f_error shen.remember-datatype))))
|
78
78
|
|
79
|
-
(defun shen.rules->horn-clauses (
|
79
|
+
(defun shen.rules->horn-clauses (V1403 V1404) (cond ((= () V1404) ()) ((and (cons? V1404) (and (tuple? (hd V1404)) (= shen.single (fst (hd V1404))))) (cons (shen.rule->horn-clause V1403 (snd (hd V1404))) (shen.rules->horn-clauses V1403 (tl V1404)))) ((and (cons? V1404) (and (tuple? (hd V1404)) (= shen.double (fst (hd V1404))))) (shen.rules->horn-clauses V1403 (append (shen.double->singles (snd (hd V1404))) (tl V1404)))) (true (shen.f_error shen.rules->horn-clauses))))
|
80
80
|
|
81
|
-
(defun shen.double->singles (
|
81
|
+
(defun shen.double->singles (V1405) (cons (shen.right-rule V1405) (cons (shen.left-rule V1405) ())))
|
82
82
|
|
83
|
-
(defun shen.right-rule (
|
83
|
+
(defun shen.right-rule (V1406) (@p shen.single V1406))
|
84
84
|
|
85
|
-
(defun shen.left-rule (
|
85
|
+
(defun shen.left-rule (V1407) (cond ((and (cons? V1407) (and (cons? (tl V1407)) (and (cons? (tl (tl V1407))) (and (tuple? (hd (tl (tl V1407)))) (and (= () (fst (hd (tl (tl V1407))))) (= () (tl (tl (tl V1407))))))))) (let Q (gensym Qv) (let NewConclusion (@p (cons (snd (hd (tl (tl V1407)))) ()) Q) (let NewPremises (cons (@p (map (lambda V1359 (shen.right->left V1359)) (hd (tl V1407))) Q) ()) (@p shen.single (cons (hd V1407) (cons NewPremises (cons NewConclusion ())))))))) (true (shen.f_error shen.left-rule))))
|
86
86
|
|
87
|
-
(defun shen.right->left (
|
87
|
+
(defun shen.right->left (V1412) (cond ((and (tuple? V1412) (= () (fst V1412))) (snd V1412)) (true (simple-error "syntax error with ==========
|
88
88
|
"))))
|
89
89
|
|
90
|
-
(defun shen.rule->horn-clause (
|
90
|
+
(defun shen.rule->horn-clause (V1413 V1414) (cond ((and (cons? V1414) (and (cons? (tl V1414)) (and (cons? (tl (tl V1414))) (and (tuple? (hd (tl (tl V1414)))) (= () (tl (tl (tl V1414)))))))) (cons (shen.rule->horn-clause-head V1413 (snd (hd (tl (tl V1414))))) (cons :- (cons (shen.rule->horn-clause-body (hd V1414) (hd (tl V1414)) (fst (hd (tl (tl V1414))))) ())))) (true (shen.f_error shen.rule->horn-clause))))
|
91
91
|
|
92
|
-
(defun shen.rule->horn-clause-head (
|
92
|
+
(defun shen.rule->horn-clause-head (V1415 V1416) (cons V1415 (cons (shen.mode-ify V1416) (cons Context_1957 ()))))
|
93
93
|
|
94
|
-
(defun shen.mode-ify (
|
94
|
+
(defun shen.mode-ify (V1417) (cond ((and (cons? V1417) (and (cons? (tl V1417)) (and (= : (hd (tl V1417))) (and (cons? (tl (tl V1417))) (= () (tl (tl (tl V1417)))))))) (cons mode (cons (cons (hd V1417) (cons : (cons (cons mode (cons (hd (tl (tl V1417))) (cons + ()))) ()))) (cons - ())))) (true V1417)))
|
95
95
|
|
96
|
-
(defun shen.rule->horn-clause-body (
|
96
|
+
(defun shen.rule->horn-clause-body (V1418 V1419 V1420) (let Variables (map (lambda V1360 (shen.extract_vars V1360)) V1420) (let Predicates (map (lambda X (gensym shen.cl)) V1420) (let SearchLiterals (shen.construct-search-literals Predicates Variables Context_1957 Context1_1957) (let SearchClauses (shen.construct-search-clauses Predicates V1420 Variables) (let SideLiterals (shen.construct-side-literals V1418) (let PremissLiterals (map (lambda X (shen.construct-premiss-literal X (empty? V1420))) V1419) (append SearchLiterals (append SideLiterals PremissLiterals)))))))))
|
97
97
|
|
98
|
-
(defun shen.construct-search-literals (
|
98
|
+
(defun shen.construct-search-literals (V1425 V1426 V1427 V1428) (cond ((and (= () V1425) (= () V1426)) ()) (true (shen.csl-help V1425 V1426 V1427 V1428))))
|
99
99
|
|
100
|
-
(defun shen.csl-help (
|
100
|
+
(defun shen.csl-help (V1431 V1432 V1433 V1434) (cond ((and (= () V1431) (= () V1432)) (cons (cons bind (cons ContextOut_1957 (cons V1433 ()))) ())) ((and (cons? V1431) (cons? V1432)) (cons (cons (hd V1431) (cons V1433 (cons V1434 (hd V1432)))) (shen.csl-help (tl V1431) (tl V1432) V1434 (gensym Context)))) (true (shen.f_error shen.csl-help))))
|
101
101
|
|
102
|
-
(defun shen.construct-search-clauses (
|
102
|
+
(defun shen.construct-search-clauses (V1435 V1436 V1437) (cond ((and (= () V1435) (and (= () V1436) (= () V1437))) shen.skip) ((and (cons? V1435) (and (cons? V1436) (cons? V1437))) (do (shen.construct-search-clause (hd V1435) (hd V1436) (hd V1437)) (shen.construct-search-clauses (tl V1435) (tl V1436) (tl V1437)))) (true (shen.f_error shen.construct-search-clauses))))
|
103
103
|
|
104
|
-
(defun shen.construct-search-clause (
|
104
|
+
(defun shen.construct-search-clause (V1438 V1439 V1440) (shen.s-prolog (cons (shen.construct-base-search-clause V1438 V1439 V1440) (cons (shen.construct-recursive-search-clause V1438 V1439 V1440) ()))))
|
105
105
|
|
106
|
-
(defun shen.construct-base-search-clause (
|
106
|
+
(defun shen.construct-base-search-clause (V1441 V1442 V1443) (cons (cons V1441 (cons (cons (shen.mode-ify V1442) In_1957) (cons In_1957 V1443))) (cons :- (cons () ()))))
|
107
107
|
|
108
|
-
(defun shen.construct-recursive-search-clause (
|
108
|
+
(defun shen.construct-recursive-search-clause (V1444 V1445 V1446) (cons (cons V1444 (cons (cons Assumption_1957 Assumptions_1957) (cons (cons Assumption_1957 Out_1957) V1446))) (cons :- (cons (cons (cons V1444 (cons Assumptions_1957 (cons Out_1957 V1446))) ()) ()))))
|
109
109
|
|
110
|
-
(defun shen.construct-side-literals (
|
110
|
+
(defun shen.construct-side-literals (V1451) (cond ((= () V1451) ()) ((and (cons? V1451) (and (cons? (hd V1451)) (and (= if (hd (hd V1451))) (and (cons? (tl (hd V1451))) (= () (tl (tl (hd V1451)))))))) (cons (cons when (tl (hd V1451))) (shen.construct-side-literals (tl V1451)))) ((and (cons? V1451) (and (cons? (hd V1451)) (and (= let (hd (hd V1451))) (and (cons? (tl (hd V1451))) (and (cons? (tl (tl (hd V1451)))) (= () (tl (tl (tl (hd V1451)))))))))) (cons (cons is (tl (hd V1451))) (shen.construct-side-literals (tl V1451)))) ((cons? V1451) (shen.construct-side-literals (tl V1451))) (true (shen.f_error shen.construct-side-literals))))
|
111
111
|
|
112
|
-
(defun shen.construct-premiss-literal (
|
112
|
+
(defun shen.construct-premiss-literal (V1456 V1457) (cond ((tuple? V1456) (cons shen.t* (cons (shen.recursive_cons_form (snd V1456)) (cons (shen.construct-context V1457 (fst V1456)) ())))) ((= ! V1456) (cons cut (cons Throwcontrol ()))) (true (shen.f_error shen.construct-premiss-literal))))
|
113
113
|
|
114
|
-
(defun shen.construct-context (
|
114
|
+
(defun shen.construct-context (V1458 V1459) (cond ((and (= true V1458) (= () V1459)) Context_1957) ((and (= false V1458) (= () V1459)) ContextOut_1957) ((cons? V1459) (cons cons (cons (shen.recursive_cons_form (hd V1459)) (cons (shen.construct-context V1458 (tl V1459)) ())))) (true (shen.f_error shen.construct-context))))
|
115
115
|
|
116
|
-
(defun shen.recursive_cons_form (
|
116
|
+
(defun shen.recursive_cons_form (V1460) (cond ((cons? V1460) (cons cons (cons (shen.recursive_cons_form (hd V1460)) (cons (shen.recursive_cons_form (tl V1460)) ())))) (true V1460)))
|
117
117
|
|
118
|
-
(defun preclude (
|
118
|
+
(defun preclude (V1461) (shen.preclude-h (map (lambda V1361 (shen.intern-type V1361)) V1461)))
|
119
119
|
|
120
|
-
(defun shen.preclude-h (
|
120
|
+
(defun shen.preclude-h (V1462) (let FilterDatatypes (set shen.*datatypes* (difference (value shen.*datatypes*) V1462)) (value shen.*datatypes*)))
|
121
121
|
|
122
|
-
(defun include (
|
122
|
+
(defun include (V1463) (shen.include-h (map (lambda V1362 (shen.intern-type V1362)) V1463)))
|
123
123
|
|
124
|
-
(defun shen.include-h (
|
124
|
+
(defun shen.include-h (V1464) (let ValidTypes (intersection V1464 (value shen.*alldatatypes*)) (let NewDatatypes (set shen.*datatypes* (union ValidTypes (value shen.*datatypes*))) (value shen.*datatypes*))))
|
125
125
|
|
126
|
-
(defun preclude-all-but (
|
126
|
+
(defun preclude-all-but (V1465) (shen.preclude-h (difference (value shen.*alldatatypes*) (map (lambda V1363 (shen.intern-type V1363)) V1465))))
|
127
127
|
|
128
|
-
(defun include-all-but (
|
128
|
+
(defun include-all-but (V1466) (shen.include-h (difference (value shen.*alldatatypes*) (map (lambda V1364 (shen.intern-type V1364)) V1466))))
|
129
129
|
|
130
|
-
(defun shen.synonyms-help (
|
130
|
+
(defun shen.synonyms-help (V1471) (cond ((= () V1471) (shen.demodulation-function (value shen.*tc*) (mapcan (lambda V1365 (shen.demod-rule V1365)) (value shen.*synonyms*)))) ((and (cons? V1471) (cons? (tl V1471))) (let Vs (difference (shen.extract_vars (hd (tl V1471))) (shen.extract_vars (hd V1471))) (if (empty? Vs) (do (shen.pushnew (cons (hd V1471) (cons (hd (tl V1471)) ())) shen.*synonyms*) (shen.synonyms-help (tl (tl V1471)))) (shen.free_variable_warnings (hd (tl V1471)) Vs)))) (true (simple-error "odd number of synonyms
|
131
131
|
"))))
|
132
132
|
|
133
|
-
(defun shen.pushnew (
|
133
|
+
(defun shen.pushnew (V1472 V1473) (if (element? V1472 (value V1473)) (value V1473) (set V1473 (cons V1472 (value V1473)))))
|
134
134
|
|
135
|
-
(defun shen.demod-rule (
|
135
|
+
(defun shen.demod-rule (V1474) (cond ((and (cons? V1474) (and (cons? (tl V1474)) (= () (tl (tl V1474))))) (cons (shen.rcons_form (hd V1474)) (cons -> (cons (shen.rcons_form (hd (tl V1474))) ())))) (true (shen.f_error shen.demod-rule))))
|
136
136
|
|
137
|
-
(defun shen.demodulation-function (
|
137
|
+
(defun shen.demodulation-function (V1475 V1476) (do (tc -) (do (eval (cons define (cons shen.demod (append V1476 (shen.default-rule))))) (do (if V1475 (tc +) shen.skip) synonyms))))
|
138
138
|
|
139
139
|
(defun shen.default-rule () (cons X (cons -> (cons X ()))))
|
140
140
|
|
data/shen/release/klambda/sys.kl
CHANGED
@@ -23,214 +23,214 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
23
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
24
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
25
25
|
|
26
|
-
(defun thaw (
|
26
|
+
(defun thaw (V1483) (V1483))
|
27
27
|
|
28
|
-
(defun eval (
|
28
|
+
(defun eval (V1484) (let Macroexpand (shen.walk (lambda V1477 (macroexpand V1477)) V1484) (if (shen.packaged? Macroexpand) (map (lambda V1478 (shen.eval-without-macros V1478)) (shen.package-contents Macroexpand)) (shen.eval-without-macros Macroexpand))))
|
29
29
|
|
30
|
-
(defun shen.eval-without-macros (
|
30
|
+
(defun shen.eval-without-macros (V1485) (eval-kl (shen.elim-def (shen.proc-input+ V1485))))
|
31
31
|
|
32
|
-
(defun shen.proc-input+ (
|
32
|
+
(defun shen.proc-input+ (V1486) (cond ((and (cons? V1486) (and (= input+ (hd V1486)) (and (cons? (tl V1486)) (and (cons? (tl (tl V1486))) (= () (tl (tl (tl V1486)))))))) (cons input+ (cons (shen.rcons_form (hd (tl V1486))) (tl (tl V1486))))) ((and (cons? V1486) (and (= shen.read+ (hd V1486)) (and (cons? (tl V1486)) (and (cons? (tl (tl V1486))) (= () (tl (tl (tl V1486)))))))) (cons shen.read+ (cons (shen.rcons_form (hd (tl V1486))) (tl (tl V1486))))) ((cons? V1486) (map (lambda V1479 (shen.proc-input+ V1479)) V1486)) (true V1486)))
|
33
33
|
|
34
|
-
(defun shen.elim-def (
|
34
|
+
(defun shen.elim-def (V1487) (cond ((and (cons? V1487) (and (= define (hd V1487)) (cons? (tl V1487)))) (shen.shen->kl (hd (tl V1487)) (tl (tl V1487)))) ((and (cons? V1487) (and (= defmacro (hd V1487)) (cons? (tl V1487)))) (let Default (cons X (cons -> (cons X ()))) (let Def (shen.elim-def (cons define (cons (hd (tl V1487)) (append (tl (tl V1487)) Default)))) (let MacroAdd (shen.add-macro (hd (tl V1487))) Def)))) ((and (cons? V1487) (and (= defcc (hd V1487)) (cons? (tl V1487)))) (shen.elim-def (shen.yacc V1487))) ((cons? V1487) (map (lambda V1480 (shen.elim-def V1480)) V1487)) (true V1487)))
|
35
35
|
|
36
|
-
(defun shen.add-macro (
|
36
|
+
(defun shen.add-macro (V1488) (let MacroReg (value shen.*macroreg*) (let NewMacroReg (set shen.*macroreg* (adjoin V1488 (value shen.*macroreg*))) (if (= MacroReg NewMacroReg) shen.skip (set *macros* (cons (lambda V1481 (V1488 V1481)) (value *macros*)))))))
|
37
37
|
|
38
|
-
(defun shen.packaged? (
|
38
|
+
(defun shen.packaged? (V1495) (cond ((and (cons? V1495) (and (= package (hd V1495)) (and (cons? (tl V1495)) (cons? (tl (tl V1495)))))) true) (true false)))
|
39
39
|
|
40
|
-
(defun external (
|
40
|
+
(defun external (V1496) (trap-error (get V1496 shen.external-symbols (value *property-vector*)) (lambda E (simple-error (cn "package " (shen.app V1496 " has not been used.
|
41
41
|
" shen.a))))))
|
42
42
|
|
43
|
-
(defun shen.package-contents (
|
43
|
+
(defun shen.package-contents (V1499) (cond ((and (cons? V1499) (and (= package (hd V1499)) (and (cons? (tl V1499)) (and (= null (hd (tl V1499))) (cons? (tl (tl V1499))))))) (tl (tl (tl V1499)))) ((and (cons? V1499) (and (= package (hd V1499)) (and (cons? (tl V1499)) (cons? (tl (tl V1499)))))) (shen.packageh (hd (tl V1499)) (hd (tl (tl V1499))) (tl (tl (tl V1499))))) (true (shen.f_error shen.package-contents))))
|
44
44
|
|
45
|
-
(defun shen.walk (
|
45
|
+
(defun shen.walk (V1500 V1501) (cond ((cons? V1501) (V1500 (map (lambda Z (shen.walk V1500 Z)) V1501))) (true (V1500 V1501))))
|
46
46
|
|
47
|
-
(defun compile (
|
47
|
+
(defun compile (V1502 V1503 V1504) (let O (V1502 (cons V1503 (cons () ()))) (if (or (= (fail) O) (not (empty? (hd O)))) (V1504 O) (shen.hdtl O))))
|
48
48
|
|
49
|
-
(defun fail-if (
|
49
|
+
(defun fail-if (V1505 V1506) (if (V1505 V1506) (fail) V1506))
|
50
50
|
|
51
|
-
(defun @s (
|
51
|
+
(defun @s (V1507 V1508) (cn V1507 V1508))
|
52
52
|
|
53
53
|
(defun tc? () (value shen.*tc*))
|
54
54
|
|
55
|
-
(defun ps (
|
55
|
+
(defun ps (V1509) (trap-error (get V1509 shen.source (value *property-vector*)) (lambda E (simple-error (shen.app V1509 " not found.
|
56
56
|
" shen.a)))))
|
57
57
|
|
58
58
|
(defun stinput () (value *stinput*))
|
59
59
|
|
60
|
-
(defun shen.+vector? (
|
60
|
+
(defun shen.+vector? (V1510) (and (absvector? V1510) (> (<-address V1510 0) 0)))
|
61
61
|
|
62
|
-
(defun vector (
|
62
|
+
(defun vector (V1511) (let Vector (absvector (+ V1511 1)) (let ZeroStamp (address-> Vector 0 V1511) (let Standard (if (= V1511 0) ZeroStamp (shen.fillvector ZeroStamp 1 V1511 (fail))) Standard))))
|
63
63
|
|
64
|
-
(defun shen.fillvector (
|
64
|
+
(defun shen.fillvector (V1513 V1514 V1515 V1516) (cond ((= V1515 V1514) (address-> V1513 V1515 V1516)) (true (shen.fillvector (address-> V1513 V1514 V1516) (+ 1 V1514) V1515 V1516))))
|
65
65
|
|
66
|
-
(defun vector? (
|
66
|
+
(defun vector? (V1517) (and (absvector? V1517) (trap-error (>= (<-address V1517 0) 0) (lambda E false))))
|
67
67
|
|
68
|
-
(defun vector-> (
|
69
|
-
") (address->
|
68
|
+
(defun vector-> (V1518 V1519 V1520) (if (= V1519 0) (simple-error "cannot access 0th element of a vector
|
69
|
+
") (address-> V1518 V1519 V1520)))
|
70
70
|
|
71
|
-
(defun <-vector (
|
72
|
-
") (let VectorElement (<-address
|
71
|
+
(defun <-vector (V1521 V1522) (if (= V1522 0) (simple-error "cannot access 0th element of a vector
|
72
|
+
") (let VectorElement (<-address V1521 V1522) (if (= VectorElement (fail)) (simple-error "vector element not found
|
73
73
|
") VectorElement))))
|
74
74
|
|
75
|
-
(defun shen.posint? (
|
75
|
+
(defun shen.posint? (V1523) (and (integer? V1523) (>= V1523 0)))
|
76
76
|
|
77
|
-
(defun limit (
|
77
|
+
(defun limit (V1524) (<-address V1524 0))
|
78
78
|
|
79
|
-
(defun symbol? (
|
79
|
+
(defun symbol? (V1525) (cond ((or (boolean? V1525) (or (number? V1525) (string? V1525))) false) (true (trap-error (let String (str V1525) (shen.analyse-symbol? String)) (lambda E false)))))
|
80
80
|
|
81
|
-
(defun shen.analyse-symbol? (
|
81
|
+
(defun shen.analyse-symbol? (V1526) (cond ((shen.+string? V1526) (and (shen.alpha? (pos V1526 0)) (shen.alphanums? (tlstr V1526)))) (true (shen.f_error shen.analyse-symbol?))))
|
82
82
|
|
83
|
-
(defun shen.alpha? (
|
83
|
+
(defun shen.alpha? (V1527) (element? V1527 (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 "." ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
84
84
|
|
85
|
-
(defun shen.alphanums? (
|
85
|
+
(defun shen.alphanums? (V1528) (cond ((= "" V1528) true) ((shen.+string? V1528) (and (shen.alphanum? (pos V1528 0)) (shen.alphanums? (tlstr V1528)))) (true (shen.f_error shen.alphanums?))))
|
86
86
|
|
87
|
-
(defun shen.alphanum? (
|
87
|
+
(defun shen.alphanum? (V1529) (or (shen.alpha? V1529) (shen.digit? V1529)))
|
88
88
|
|
89
|
-
(defun shen.digit? (
|
89
|
+
(defun shen.digit? (V1530) (element? V1530 (cons "1" (cons "2" (cons "3" (cons "4" (cons "5" (cons "6" (cons "7" (cons "8" (cons "9" (cons "0" ()))))))))))))
|
90
90
|
|
91
|
-
(defun variable? (
|
91
|
+
(defun variable? (V1531) (cond ((or (boolean? V1531) (or (number? V1531) (string? V1531))) false) (true (trap-error (let String (str V1531) (shen.analyse-variable? String)) (lambda E false)))))
|
92
92
|
|
93
|
-
(defun shen.analyse-variable? (
|
93
|
+
(defun shen.analyse-variable? (V1532) (cond ((shen.+string? V1532) (and (shen.uppercase? (pos V1532 0)) (shen.alphanums? (tlstr V1532)))) (true (shen.f_error shen.analyse-variable?))))
|
94
94
|
|
95
|
-
(defun shen.uppercase? (
|
95
|
+
(defun shen.uppercase? (V1533) (element? V1533 (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" ()))))))))))))))))))))))))))))
|
96
96
|
|
97
|
-
(defun gensym (
|
97
|
+
(defun gensym (V1534) (concat V1534 (set shen.*gensym* (+ 1 (value shen.*gensym*)))))
|
98
98
|
|
99
|
-
(defun concat (
|
99
|
+
(defun concat (V1535 V1536) (intern (cn (str V1535) (str V1536))))
|
100
100
|
|
101
|
-
(defun @p (
|
101
|
+
(defun @p (V1537 V1538) (let Vector (absvector 3) (let Tag (address-> Vector 0 shen.tuple) (let Fst (address-> Vector 1 V1537) (let Snd (address-> Vector 2 V1538) Vector)))))
|
102
102
|
|
103
|
-
(defun fst (
|
103
|
+
(defun fst (V1539) (<-address V1539 1))
|
104
104
|
|
105
|
-
(defun snd (
|
105
|
+
(defun snd (V1540) (<-address V1540 2))
|
106
106
|
|
107
|
-
(defun tuple? (
|
107
|
+
(defun tuple? (V1541) (trap-error (and (absvector? V1541) (= shen.tuple (<-address V1541 0))) (lambda E false)))
|
108
108
|
|
109
|
-
(defun append (
|
109
|
+
(defun append (V1542 V1543) (cond ((= () V1542) V1543) ((cons? V1542) (cons (hd V1542) (append (tl V1542) V1543))) (true (shen.f_error append))))
|
110
110
|
|
111
|
-
(defun @v (
|
111
|
+
(defun @v (V1544 V1545) (let Limit (limit V1545) (let NewVector (vector (+ Limit 1)) (let X+NewVector (vector-> NewVector 1 V1544) (if (= Limit 0) X+NewVector (shen.@v-help V1545 1 Limit X+NewVector))))))
|
112
112
|
|
113
|
-
(defun shen.@v-help (
|
113
|
+
(defun shen.@v-help (V1547 V1548 V1549 V1550) (cond ((= V1549 V1548) (shen.copyfromvector V1547 V1550 V1549 (+ V1549 1))) (true (shen.@v-help V1547 (+ V1548 1) V1549 (shen.copyfromvector V1547 V1550 V1548 (+ V1548 1))))))
|
114
114
|
|
115
|
-
(defun shen.copyfromvector (
|
115
|
+
(defun shen.copyfromvector (V1551 V1552 V1553 V1554) (trap-error (vector-> V1552 V1554 (<-vector V1551 V1553)) (lambda E V1552)))
|
116
116
|
|
117
|
-
(defun hdv (
|
117
|
+
(defun hdv (V1555) (trap-error (<-vector V1555 1) (lambda E (simple-error (cn "hdv needs a non-empty vector as an argument; not " (shen.app V1555 "
|
118
118
|
" shen.s))))))
|
119
119
|
|
120
|
-
(defun tlv (
|
121
|
-
") (if (= Limit 1) (vector 0) (let NewVector (vector (- Limit 1)) (shen.tlv-help
|
120
|
+
(defun tlv (V1556) (let Limit (limit V1556) (if (= Limit 0) (simple-error "cannot take the tail of the empty vector
|
121
|
+
") (if (= Limit 1) (vector 0) (let NewVector (vector (- Limit 1)) (shen.tlv-help V1556 2 Limit (vector (- Limit 1))))))))
|
122
122
|
|
123
|
-
(defun shen.tlv-help (
|
123
|
+
(defun shen.tlv-help (V1558 V1559 V1560 V1561) (cond ((= V1560 V1559) (shen.copyfromvector V1558 V1561 V1560 (- V1560 1))) (true (shen.tlv-help V1558 (+ V1559 1) V1560 (shen.copyfromvector V1558 V1561 V1559 (- V1559 1))))))
|
124
124
|
|
125
|
-
(defun assoc (
|
125
|
+
(defun assoc (V1571 V1572) (cond ((= () V1572) ()) ((and (cons? V1572) (and (cons? (hd V1572)) (= (hd (hd V1572)) V1571))) (hd V1572)) ((cons? V1572) (assoc V1571 (tl V1572))) (true (shen.f_error assoc))))
|
126
126
|
|
127
|
-
(defun boolean? (
|
127
|
+
(defun boolean? (V1577) (cond ((= true V1577) true) ((= false V1577) true) (true false)))
|
128
128
|
|
129
|
-
(defun nl (
|
130
|
-
" (stoutput)) (nl (-
|
129
|
+
(defun nl (V1578) (cond ((= 0 V1578) 0) (true (do (shen.prhush "
|
130
|
+
" (stoutput)) (nl (- V1578 1))))))
|
131
131
|
|
132
|
-
(defun difference (
|
132
|
+
(defun difference (V1581 V1582) (cond ((= () V1581) ()) ((cons? V1581) (if (element? (hd V1581) V1582) (difference (tl V1581) V1582) (cons (hd V1581) (difference (tl V1581) V1582)))) (true (shen.f_error difference))))
|
133
133
|
|
134
|
-
(defun do (
|
134
|
+
(defun do (V1583 V1584) V1584)
|
135
135
|
|
136
|
-
(defun element? (
|
136
|
+
(defun element? (V1594 V1595) (cond ((= () V1595) false) ((and (cons? V1595) (= (hd V1595) V1594)) true) ((cons? V1595) (element? V1594 (tl V1595))) (true (shen.f_error element?))))
|
137
137
|
|
138
|
-
(defun empty? (
|
138
|
+
(defun empty? (V1600) (cond ((= () V1600) true) (true false)))
|
139
139
|
|
140
|
-
(defun fix (
|
140
|
+
(defun fix (V1601 V1602) (shen.fix-help V1601 V1602 (V1601 V1602)))
|
141
141
|
|
142
|
-
(defun shen.fix-help (
|
142
|
+
(defun shen.fix-help (V1610 V1611 V1612) (cond ((= V1612 V1611) V1612) (true (shen.fix-help V1610 V1612 (V1610 V1612)))))
|
143
143
|
|
144
|
-
(defun put (
|
144
|
+
(defun put (V1613 V1614 V1615 V1616) (let N (hash V1613 (limit V1616)) (let Entry (trap-error (<-vector V1616 N) (lambda E ())) (let Change (vector-> V1616 N (shen.change-pointer-value V1613 V1614 V1615 Entry)) V1615))))
|
145
145
|
|
146
|
-
(defun unput (
|
146
|
+
(defun unput (V1617 V1618 V1619) (let N (hash V1617 (limit V1619)) (let Entry (trap-error (<-vector V1619 N) (lambda E ())) (let Change (vector-> V1619 N (shen.remove-pointer V1617 V1618 Entry)) V1617))))
|
147
147
|
|
148
|
-
(defun shen.remove-pointer (
|
148
|
+
(defun shen.remove-pointer (V1624 V1625 V1626) (cond ((= () V1626) ()) ((and (cons? V1626) (and (cons? (hd V1626)) (and (cons? (hd (hd V1626))) (and (cons? (tl (hd (hd V1626)))) (and (= () (tl (tl (hd (hd V1626))))) (and (= (hd (tl (hd (hd V1626)))) V1625) (= (hd (hd (hd V1626))) V1624))))))) (tl V1626)) ((cons? V1626) (cons (hd V1626) (shen.remove-pointer V1624 V1625 (tl V1626)))) (true (shen.f_error shen.remove-pointer))))
|
149
149
|
|
150
|
-
(defun shen.change-pointer-value (
|
150
|
+
(defun shen.change-pointer-value (V1631 V1632 V1633 V1634) (cond ((= () V1634) (cons (cons (cons V1631 (cons V1632 ())) V1633) ())) ((and (cons? V1634) (and (cons? (hd V1634)) (and (cons? (hd (hd V1634))) (and (cons? (tl (hd (hd V1634)))) (and (= () (tl (tl (hd (hd V1634))))) (and (= (hd (tl (hd (hd V1634)))) V1632) (= (hd (hd (hd V1634))) V1631))))))) (cons (cons (hd (hd V1634)) V1633) (tl V1634))) ((cons? V1634) (cons (hd V1634) (shen.change-pointer-value V1631 V1632 V1633 (tl V1634)))) (true (shen.f_error shen.change-pointer-value))))
|
151
151
|
|
152
|
-
(defun get (
|
153
|
-
"))) (let Result (assoc (cons
|
152
|
+
(defun get (V1635 V1636 V1637) (let N (hash V1635 (limit V1637)) (let Entry (trap-error (<-vector V1637 N) (lambda E (simple-error "pointer not found
|
153
|
+
"))) (let Result (assoc (cons V1635 (cons V1636 ())) Entry) (if (empty? Result) (simple-error "value not found
|
154
154
|
") (tl Result))))))
|
155
155
|
|
156
|
-
(defun hash (
|
156
|
+
(defun hash (V1638 V1639) (let Hash (shen.mod (sum (map (lambda V1482 (string->n V1482)) (explode V1638))) V1639) (if (= 0 Hash) 1 Hash)))
|
157
157
|
|
158
|
-
(defun shen.mod (
|
158
|
+
(defun shen.mod (V1640 V1641) (shen.modh V1640 (shen.multiples V1640 (cons V1641 ()))))
|
159
159
|
|
160
|
-
(defun shen.multiples (
|
160
|
+
(defun shen.multiples (V1642 V1643) (cond ((and (cons? V1643) (> (hd V1643) V1642)) (tl V1643)) ((cons? V1643) (shen.multiples V1642 (cons (* 2 (hd V1643)) V1643))) (true (shen.f_error shen.multiples))))
|
161
161
|
|
162
|
-
(defun shen.modh (
|
162
|
+
(defun shen.modh (V1646 V1647) (cond ((= 0 V1646) 0) ((= () V1647) V1646) ((and (cons? V1647) (> (hd V1647) V1646)) (if (empty? (tl V1647)) V1646 (shen.modh V1646 (tl V1647)))) ((cons? V1647) (shen.modh (- V1646 (hd V1647)) V1647)) (true (shen.f_error shen.modh))))
|
163
163
|
|
164
|
-
(defun sum (
|
164
|
+
(defun sum (V1648) (cond ((= () V1648) 0) ((cons? V1648) (+ (hd V1648) (sum (tl V1648)))) (true (shen.f_error sum))))
|
165
165
|
|
166
|
-
(defun head (
|
166
|
+
(defun head (V1655) (cond ((cons? V1655) (hd V1655)) (true (simple-error "head expects a non-empty list"))))
|
167
167
|
|
168
|
-
(defun tail (
|
168
|
+
(defun tail (V1662) (cond ((cons? V1662) (tl V1662)) (true (simple-error "tail expects a non-empty list"))))
|
169
169
|
|
170
|
-
(defun hdstr (
|
170
|
+
(defun hdstr (V1663) (pos V1663 0))
|
171
171
|
|
172
|
-
(defun intersection (
|
172
|
+
(defun intersection (V1666 V1667) (cond ((= () V1666) ()) ((cons? V1666) (if (element? (hd V1666) V1667) (cons (hd V1666) (intersection (tl V1666) V1667)) (intersection (tl V1666) V1667))) (true (shen.f_error intersection))))
|
173
173
|
|
174
|
-
(defun reverse (
|
174
|
+
(defun reverse (V1668) (shen.reverse_help V1668 ()))
|
175
175
|
|
176
|
-
(defun shen.reverse_help (
|
176
|
+
(defun shen.reverse_help (V1669 V1670) (cond ((= () V1669) V1670) ((cons? V1669) (shen.reverse_help (tl V1669) (cons (hd V1669) V1670))) (true (shen.f_error shen.reverse_help))))
|
177
177
|
|
178
|
-
(defun union (
|
178
|
+
(defun union (V1671 V1672) (cond ((= () V1671) V1672) ((cons? V1671) (if (element? (hd V1671) V1672) (union (tl V1671) V1672) (cons (hd V1671) (union (tl V1671) V1672)))) (true (shen.f_error union))))
|
179
179
|
|
180
|
-
(defun y-or-n? (
|
181
|
-
" (stoutput)) (y-or-n?
|
180
|
+
(defun y-or-n? (V1673) (let Message (shen.prhush (shen.proc-nl V1673) (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
|
181
|
+
" (stoutput)) (y-or-n? V1673))))))))
|
182
182
|
|
183
|
-
(defun not (
|
183
|
+
(defun not (V1674) (if V1674 false true))
|
184
184
|
|
185
|
-
(defun subst (
|
185
|
+
(defun subst (V1684 V1685 V1686) (cond ((= V1686 V1685) V1684) ((cons? V1686) (map (lambda W (subst V1684 V1685 W)) V1686)) (true V1686)))
|
186
186
|
|
187
|
-
(defun explode (
|
187
|
+
(defun explode (V1687) (shen.explode-h (shen.app V1687 "" shen.a)))
|
188
188
|
|
189
|
-
(defun shen.explode-h (
|
189
|
+
(defun shen.explode-h (V1688) (cond ((= "" V1688) ()) ((shen.+string? V1688) (cons (pos V1688 0) (shen.explode-h (tlstr V1688)))) (true (shen.f_error shen.explode-h))))
|
190
190
|
|
191
|
-
(defun cd (
|
191
|
+
(defun cd (V1689) (set *home-directory* (if (= V1689 "") "" (shen.app V1689 "/" shen.a))))
|
192
192
|
|
193
|
-
(defun map (
|
193
|
+
(defun map (V1690 V1691) (shen.map-h V1690 V1691 ()))
|
194
194
|
|
195
|
-
(defun shen.map-h (
|
195
|
+
(defun shen.map-h (V1694 V1695 V1696) (cond ((= () V1695) (reverse V1696)) ((cons? V1695) (shen.map-h V1694 (tl V1695) (cons (V1694 (hd V1695)) V1696))) (true (shen.f_error shen.map-h))))
|
196
196
|
|
197
|
-
(defun length (
|
197
|
+
(defun length (V1697) (shen.length-h V1697 0))
|
198
198
|
|
199
|
-
(defun shen.length-h (
|
199
|
+
(defun shen.length-h (V1698 V1699) (cond ((= () V1698) V1699) (true (shen.length-h (tl V1698) (+ V1699 1)))))
|
200
200
|
|
201
|
-
(defun occurrences (
|
201
|
+
(defun occurrences (V1709 V1710) (cond ((= V1710 V1709) 1) ((cons? V1710) (+ (occurrences V1709 (hd V1710)) (occurrences V1709 (tl V1710)))) (true 0)))
|
202
202
|
|
203
|
-
(defun nth (
|
203
|
+
(defun nth (V1717 V1718) (cond ((and (= 1 V1717) (cons? V1718)) (hd V1718)) ((cons? V1718) (nth (- V1717 1) (tl V1718))) (true (shen.f_error nth))))
|
204
204
|
|
205
|
-
(defun integer? (
|
205
|
+
(defun integer? (V1719) (and (number? V1719) (let Abs (shen.abs V1719) (shen.integer-test? Abs (shen.magless Abs 1)))))
|
206
206
|
|
207
|
-
(defun shen.abs (
|
207
|
+
(defun shen.abs (V1720) (if (> V1720 0) V1720 (- 0 V1720)))
|
208
208
|
|
209
|
-
(defun shen.magless (
|
209
|
+
(defun shen.magless (V1721 V1722) (let Nx2 (* V1722 2) (if (> Nx2 V1721) V1722 (shen.magless V1721 Nx2))))
|
210
210
|
|
211
|
-
(defun shen.integer-test? (
|
211
|
+
(defun shen.integer-test? (V1726 V1727) (cond ((= 0 V1726) true) ((> 1 V1726) false) (true (let Abs-N (- V1726 V1727) (if (> 0 Abs-N) (integer? V1726) (shen.integer-test? Abs-N V1727))))))
|
212
212
|
|
213
|
-
(defun mapcan (
|
213
|
+
(defun mapcan (V1730 V1731) (cond ((= () V1731) ()) ((cons? V1731) (append (V1730 (hd V1731)) (mapcan V1730 (tl V1731)))) (true (shen.f_error mapcan))))
|
214
214
|
|
215
|
-
(defun == (
|
215
|
+
(defun == (V1741 V1742) (cond ((= V1742 V1741) true) (true false)))
|
216
216
|
|
217
217
|
(defun abort () (simple-error ""))
|
218
218
|
|
219
|
-
(defun bound? (
|
219
|
+
(defun bound? (V1743) (and (symbol? V1743) (let Val (trap-error (value V1743) (lambda E shen.this-symbol-is-unbound)) (if (= Val shen.this-symbol-is-unbound) false true))))
|
220
220
|
|
221
|
-
(defun shen.string->bytes (
|
221
|
+
(defun shen.string->bytes (V1744) (cond ((= "" V1744) ()) (true (cons (string->n (pos V1744 0)) (shen.string->bytes (tlstr V1744))))))
|
222
222
|
|
223
|
-
(defun maxinferences (
|
223
|
+
(defun maxinferences (V1745) (set shen.*maxinferences* V1745))
|
224
224
|
|
225
225
|
(defun inferences () (value shen.*infs*))
|
226
226
|
|
227
|
-
(defun protect (
|
227
|
+
(defun protect (V1746) V1746)
|
228
228
|
|
229
229
|
(defun stoutput () (value *stoutput*))
|
230
230
|
|
231
|
-
(defun string->symbol (
|
231
|
+
(defun string->symbol (V1747) (let Symbol (intern V1747) (if (symbol? Symbol) Symbol (simple-error (cn "cannot intern " (shen.app V1747 " to a symbol" shen.s))))))
|
232
232
|
|
233
|
-
(defun optimise (
|
233
|
+
(defun optimise (V1752) (cond ((= + V1752) (set shen.*optimise* true)) ((= - V1752) (set shen.*optimise* false)) (true (simple-error "optimise expects a + or a -.
|
234
234
|
"))))
|
235
235
|
|
236
236
|
(defun os () (value *os*))
|
@@ -247,7 +247,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
|
247
247
|
|
248
248
|
(defun release () (value *release*))
|
249
249
|
|
250
|
-
(defun package? (
|
250
|
+
(defun package? (V1753) (trap-error (do (external V1753) true) (lambda E false)))
|
251
251
|
|
252
252
|
|
253
253
|
|