3 (def! bind-env (fn* [env b e]
7 (if (= "&" (str (first b)))
8 (assoc env (str (nth b 1)) e)
10 (bind-env (assoc env (str (first b)) (first e))
11 (rest b) (rest e))))))
13 (def! new-env (fn* [& args]
14 (if (<= (count args) 1)
15 (atom {"--outer--" (first args)})
16 (atom (bind-env {"--outer--" (first args)}
17 (nth args 1) (nth args 2))))))
19 (def! env-find (fn* [env k]
22 (if (contains? data ks)
24 (if (get data "--outer--")
25 (env-find (get data "--outer--") ks)
28 (def! env-get (fn* [env k]
33 (throw (str "'" ks "' not found"))))))
35 (def! env-set (fn* [env k v]
37 (swap! env assoc (str k) v)
40 ;;(prn "loaded env.mal")