From 06d499dd9479acd74d45542cc7bdda61a280653b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 11 Apr 2024 23:02:40 -0500 Subject: Add values and string-append --- core.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core.lua b/core.lua index 556b5d1..556866c 100644 --- a/core.lua +++ b/core.lua @@ -29,6 +29,12 @@ end -- from what i understand of the spec, it's okay that eqv? and eq? are the same env["eq?"] = env["eqv?"] +---[[ VALUES ]]--- + +env.values = function (r) + return table.unpack(type.totable(r)) +end + ---[[ TYPES ]]--- env["boolean?"] = function (r) @@ -192,6 +198,18 @@ env["/"] = function (r) r[1], r[2]) end +---[[ STRINGS ]]--- + +env["string-append"] = function (r) + assert_arity(r,1) + local ss = type.totable(r) + local new = {} + for i, s in ipairs(ss) do + new[i] = s.v + end + return type.string(table.concat(new)) +end + ---[[ INPUT / OUTPUT ]]--- env.dump = function (r) -- cgit 1.4.1-21-gabe81