about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-03-31 22:13:51 -0500
committerCase Duckworth2024-03-31 22:13:51 -0500
commit012ecba60a13af0b493cc510f11d1108c0694584 (patch)
treefb2bd62d3b7b5da4c84b16af53adc813105b66c9
parentImprove dotted-pair reads (diff)
downloadlam-012ecba60a13af0b493cc510f11d1108c0694584.tar.gz
lam-012ecba60a13af0b493cc510f11d1108c0694584.zip
Expose `specials'
-rw-r--r--eval.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/eval.lua b/eval.lua index 4a4ad0e..e13fb97 100644 --- a/eval.lua +++ b/eval.lua
@@ -49,6 +49,7 @@ function m.procedure (params, body, env)
49end 49end
50 50
51local specials = { 51local specials = {
52m.specials = {
52 -- each of these takes R (a list of args) and E (an environment) 53 -- each of these takes R (a list of args) and E (an environment)
53 quote = 54 quote =
54 function (r, e) return r[1] end, 55 function (r, e) return r[1] end,
@@ -70,8 +71,8 @@ local specials = {
70 -- TODO: include, import, define-syntax, ... 71 -- TODO: include, import, define-syntax, ...
71} 72}
72-- Aliases 73-- Aliases
73specials.lam = specials.lambda 74m.specials.lam = m.specials.lambda
74specials.def = specials.define 75m.specials.def = m.specials.define
75 76
76function m.eval (x, env) 77function m.eval (x, env)
77 local env = env or core.env 78 local env = env or core.env
@@ -81,8 +82,8 @@ function m.eval (x, env)
81 return x 82 return x
82 else 83 else
83 local op, args = x[1], x[2] 84 local op, args = x[1], x[2]
84 if specials[op] then 85 if m.specials[op] then
85 return specials[op](args, env) 86 return m.specials[op](args, env)
86 else -- procedure call 87 else -- procedure call
87 local fn = m.eval(op, env) 88 local fn = m.eval(op, env)
88 local params = {} 89 local params = {}