about summary refs log tree commit diff stats
path: root/type.lua
diff options
context:
space:
mode:
authorCase Duckworth2024-03-20 21:55:09 -0500
committerCase Duckworth2024-03-20 21:55:09 -0500
commit4dde2320effedfc1baac0a0b2011ab2ddbc20c74 (patch)
tree0fa7d06410633b2f0e715e96670735e85e3299e9 /type.lua
parentAdd luarepl target (diff)
downloadlam-4dde2320effedfc1baac0a0b2011ab2ddbc20c74.tar.gz
lam-4dde2320effedfc1baac0a0b2011ab2ddbc20c74.zip
Support dotted lists in reader
Diffstat (limited to 'type.lua')
-rw-r--r--type.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/type.lua b/type.lua index 0d3b776..0a0c62d 100644 --- a/type.lua +++ b/type.lua
@@ -115,12 +115,12 @@ function t.isNull (x)
115end 115end
116 116
117-- Lists are chained Conses ending in Null 117-- Lists are chained Conses ending in Null
118function t.List (items) 118function t.List (items, last)
119 local function tolist (base, items) 119 local function tolist (base, items)
120 if #items == 0 then return base end 120 if #items == 0 then return base end
121 return tolist(t.Cons(table.remove(items), base), items) 121 return tolist(t.Cons(table.remove(items), base), items)
122 end 122 end
123 return tolist(t.Null, items) 123 return tolist(last or t.Null, items)
124end 124end
125 125
126function t.isList (x) 126function t.isList (x)