about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-03-31 22:14:31 -0500
committerCase Duckworth2024-03-31 22:14:31 -0500
commit877fca875a92c01089ca0697e1aeecb1ff37708e (patch)
treeca2d4e3f2e8c369cb464c0ea4fe71197e34693a5
parentAdd quasiquote (diff)
downloadlam-877fca875a92c01089ca0697e1aeecb1ff37708e.tar.gz
lam-877fca875a92c01089ca0697e1aeecb1ff37708e.zip
Error on unbound variables
I still need to catch errors!
-rw-r--r--eval.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/eval.lua b/eval.lua index 714c67e..2e3a2bf 100644 --- a/eval.lua +++ b/eval.lua
@@ -103,6 +103,9 @@ m.specials.def = m.specials.define
103function m.eval (x, env) 103function m.eval (x, env)
104 local env = env or core.env 104 local env = env or core.env
105 if type.isa(x, "symbol") then 105 if type.isa(x, "symbol") then
106 if env[x] == nil then
107 error(string.format("Unbound variable: %s", x))
108 end
106 return env[x] 109 return env[x]
107 elseif not type.islist(x) then 110 elseif not type.islist(x) then
108 return x 111 return x