diff options
-rw-r--r-- | eval.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/eval.lua b/eval.lua index 2e3a2bf..c2945bf 100644 --- a/eval.lua +++ b/eval.lua | |||
@@ -82,9 +82,16 @@ m.specials = { | |||
82 | end | 82 | end |
83 | return type.list(QQ, fin) | 83 | return type.list(QQ, fin) |
84 | end, | 84 | end, |
85 | -- if not inside quasiquote, unquote and unquote-splicing are errors | ||
86 | unquote = function () error("Unexpected unquote") end, | ||
87 | ["unquote-splicing"] = | ||
88 | function () error("Unexpected unquote-splicing") end, | ||
89 | -- define variables | ||
85 | define = function (r, e) rawset(e, r[1], m.eval(r[2][1], e)) end, | 90 | define = function (r, e) rawset(e, r[1], m.eval(r[2][1], e)) end, |
86 | lambda = function (r, e) return m.procedure(r[1], r[2], e) end, | ||
87 | ["set!"] = function (r, e) e[r[1]] = m.eval(r[2][1], e) end, | 91 | ["set!"] = function (r, e) e[r[1]] = m.eval(r[2][1], e) end, |
92 | -- y'know, ... lambda | ||
93 | lambda = function (r, e) return m.procedure(r[1], r[2], e) end, | ||
94 | -- control flow | ||
88 | ["if"] = | 95 | ["if"] = |
89 | function (r, e) | 96 | function (r, e) |
90 | local test, conseq, alt = | 97 | local test, conseq, alt = |