From 255a79680b7d4f85e4e5862254dd1c3c98f8be86 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 3 Apr 2024 22:47:11 -0500 Subject: Add eqv?, eq? --- core.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'core.lua') 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) end m.env = { -- all functions here take R, which is the list of arguments + ------- equivalence + ["eqv?"] = + function (r) + assert_arity(r, 2, 2) + return r[1] == r[2][1] + end, + ["eq?"] = + function (r) + assert_arity(r, 2, 2) + -- from how i understand the Scheme spec, it's okay to + -- make `eqv?' and `eq?' the same. + return r[1] == r[2][1] + end, + -- equal? can be done in-library ------- numbers + -- todo: assert all of these are numbers ["number?"] = function (r) assert_arity(r, 1, 1) -- cgit 1.4.1-21-gabe81