diff options
-rw-r--r-- | core.lua | 15 | ||||
-rw-r--r-- | eval.lua | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/core.lua b/core.lua index 7891f3a..9563904 100644 --- a/core.lua +++ b/core.lua | |||
@@ -18,7 +18,22 @@ local function fold (kons, knil, r) | |||
18 | end | 18 | end |
19 | 19 | ||
20 | m.env = { -- all functions here take R, which is the list of arguments | 20 | m.env = { -- all functions here take R, which is the list of arguments |
21 | ------- equivalence | ||
22 | ["eqv?"] = | ||
23 | function (r) | ||
24 | assert_arity(r, 2, 2) | ||
25 | return r[1] == r[2][1] | ||
26 | end, | ||
27 | ["eq?"] = | ||
28 | function (r) | ||
29 | assert_arity(r, 2, 2) | ||
30 | -- from how i understand the Scheme spec, it's okay to | ||
31 | -- make `eqv?' and `eq?' the same. | ||
32 | return r[1] == r[2][1] | ||
33 | end, | ||
34 | -- equal? can be done in-library | ||
21 | ------- numbers | 35 | ------- numbers |
36 | -- todo: assert all of these are numbers | ||
22 | ["number?"] = | 37 | ["number?"] = |
23 | function (r) | 38 | function (r) |
24 | assert_arity(r, 1, 1) | 39 | assert_arity(r, 1, 1) |
diff --git a/eval.lua b/eval.lua index 60369a9..e3e21c3 100644 --- a/eval.lua +++ b/eval.lua | |||
@@ -3,6 +3,7 @@ | |||
3 | local m = {} | 3 | local m = {} |
4 | local core = require "core" | 4 | local core = require "core" |
5 | local type = require "type" | 5 | local type = require "type" |
6 | local assert_arity = require("util").assert_arity | ||
6 | 7 | ||
7 | function m.environ (inner, outer) | 8 | function m.environ (inner, outer) |
8 | local mt = { | 9 | local mt = { |