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:
commit
05531aa0a4
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user