This commit is contained in:
msyds committed 2026-09-16 06:28:21 -06:00
1 parent 7700b231c9
commit 0f1287b760
4 files changed
+15 -16

No files matched your search

+3 -2
View File
@@ -9,5 +9,6 @@
io.github.msyds/spec-dict
{:git/sha "531d629b7f05f37232261cf9e8927a4b5915714f"}}
:paths ["src" "resources" "test"]
:test {:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}
:main-opts ["-m" "kaocha.runner"]}}
:aliases
{:test {:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}
:main-opts ["-m" "kaocha.runner"]}}}
+2 -14
View File
@@ -86,6 +86,8 @@
(swap! symtable-ref #(assoc-in % [sym scopes] bind))
{bind denot}))
(declare expand)
(defmethod expand-primitive 'lambda
[datum _ env symtable-ref scopes]
(let [[_ formals & body] datum
@@ -98,20 +100,6 @@
(for [e body]
(expand e env* symtable-ref scopes*)))))
(comment (assert (lookup ['lambda #{}]
scheme-base-env
(symtable-for-env scheme-base-env))))
(comment
(nearest ['x #{0 1 2}]
#{#{0}
#{0 1}
#{0 3}}))
(comment
(expand 'x)
(expand '(lambda (x) x)))
(defn expand
([datum]
(expand
+9
View File
@@ -9,6 +9,15 @@
(t/deftest symtable-for-env-test
(t/is (s/valid? ::sut/symtable (sut/symtable-for-env sut/scheme-base-env))))
(t/deftest nearest-test
(t/is (= [:primitive 'lambda]
(sut/lookup ['lambda #{}]
sut/scheme-base-env
(sut/symtable-for-env sut/scheme-base-env))))
(t/is (= [#{0 1}]
(sut/nearest ['x #{0 1 2}]
[#{0} #{0 1} #{0 3}]))))
(t/deftest expand-test
(t/testing "unbound symbol"
(t/is (thrown? Exception (sut/expand 'x))))
+1
View File
@@ -0,0 +1 @@
#kaocha/v1 {}