diff options
author | Case Duckworth | 2024-03-20 21:55:09 -0500 |
---|---|---|
committer | Case Duckworth | 2024-03-20 21:55:09 -0500 |
commit | 4dde2320effedfc1baac0a0b2011ab2ddbc20c74 (patch) | |
tree | 0fa7d06410633b2f0e715e96670735e85e3299e9 /type.lua | |
parent | Add luarepl target (diff) | |
download | lam-4dde2320effedfc1baac0a0b2011ab2ddbc20c74.tar.gz lam-4dde2320effedfc1baac0a0b2011ab2ddbc20c74.zip |
Support dotted lists in reader
Diffstat (limited to 'type.lua')
-rw-r--r-- | type.lua | 4 |
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) | |||
115 | end | 115 | end |
116 | 116 | ||
117 | -- Lists are chained Conses ending in Null | 117 | -- Lists are chained Conses ending in Null |
118 | function t.List (items) | 118 | function 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) |
124 | end | 124 | end |
125 | 125 | ||
126 | function t.isList (x) | 126 | function t.isList (x) |