about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-04-11 23:02:40 -0500
committerCase Duckworth2024-04-11 23:02:40 -0500
commit06d499dd9479acd74d45542cc7bdda61a280653b (patch)
tree2356ae543204f1fa2f616cd3fb39bf69c18825a2
parentAdd listp to assert_type (diff)
downloadlam-06d499dd9479acd74d45542cc7bdda61a280653b.tar.gz
lam-06d499dd9479acd74d45542cc7bdda61a280653b.zip
Add values and string-append
-rw-r--r--core.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/core.lua b/core.lua index 556b5d1..556866c 100644 --- a/core.lua +++ b/core.lua
@@ -29,6 +29,12 @@ end
29-- from what i understand of the spec, it's okay that eqv? and eq? are the same 29-- from what i understand of the spec, it's okay that eqv? and eq? are the same
30env["eq?"] = env["eqv?"] 30env["eq?"] = env["eqv?"]
31 31
32---[[ VALUES ]]---
33
34env.values = function (r)
35 return table.unpack(type.totable(r))
36end
37
32---[[ TYPES ]]--- 38---[[ TYPES ]]---
33 39
34env["boolean?"] = function (r) 40env["boolean?"] = function (r)
@@ -192,6 +198,18 @@ env["/"] = function (r)
192 r[1], r[2]) 198 r[1], r[2])
193end 199end
194 200
201---[[ STRINGS ]]---
202
203env["string-append"] = function (r)
204 assert_arity(r,1)
205 local ss = type.totable(r)
206 local new = {}
207 for i, s in ipairs(ss) do
208 new[i] = s.v
209 end
210 return type.string(table.concat(new))
211end
212
195---[[ INPUT / OUTPUT ]]--- 213---[[ INPUT / OUTPUT ]]---
196 214
197env.dump = function (r) 215env.dump = function (r)