1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-19 09:38:28 +03:00

Merge pull request #389 from bjh21/bjh21-mal-kw-outer

mal: Use a keyword to link each environment to its outer one.
This commit is contained in:
Joel Martin 2019-05-31 12:27:27 -04:00 committed by GitHub
commit 05531aa0a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,8 +12,8 @@
(def! new-env (fn* [& args]
(if (<= (count args) 1)
(atom {"--outer--" (first args)})
(atom (bind-env {"--outer--" (first args)}
(atom {:outer (first args)})
(atom (bind-env {:outer (first args)}
(nth args 1) (nth args 2))))))
(def! env-find (fn* [env k]
@ -21,8 +21,8 @@
data @env]
(if (contains? data ks)
env
(if (get data "--outer--")
(env-find (get data "--outer--") ks)
(if (get data :outer)
(env-find (get data :outer) ks)
nil)))))
(def! env-get (fn* [env k]