diff options
author | Case Duckworth | 2024-03-31 22:13:51 -0500 |
---|---|---|
committer | Case Duckworth | 2024-03-31 22:13:51 -0500 |
commit | 012ecba60a13af0b493cc510f11d1108c0694584 (patch) | |
tree | fb2bd62d3b7b5da4c84b16af53adc813105b66c9 | |
parent | Improve dotted-pair reads (diff) | |
download | lam-012ecba60a13af0b493cc510f11d1108c0694584.tar.gz lam-012ecba60a13af0b493cc510f11d1108c0694584.zip |
Expose `specials'
-rw-r--r-- | eval.lua | 9 |
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) | |||
49 | end | 49 | end |
50 | 50 | ||
51 | local specials = { | 51 | local specials = { |
52 | m.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 |
73 | specials.lam = specials.lambda | 74 | m.specials.lam = m.specials.lambda |
74 | specials.def = specials.define | 75 | m.specials.def = m.specials.define |
75 | 76 | ||
76 | function m.eval (x, env) | 77 | function 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 = {} |