about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-04-03 22:48:42 -0500
committerCase Duckworth2024-04-03 22:48:42 -0500
commit43b3c83967b84a80dbd1527be7ec39234d89bfce (patch)
tree45050e8224e1aec8b7d90b5d9a379beae29dae71
parentUpdate tests and readme (diff)
downloadlam-43b3c83967b84a80dbd1527be7ec39234d89bfce.tar.gz
lam-43b3c83967b84a80dbd1527be7ec39234d89bfce.zip
Add isatom()
-rw-r--r--type.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/type.lua b/type.lua index 07f78f1..f119270 100644 --- a/type.lua +++ b/type.lua
@@ -172,5 +172,18 @@ function m.islist (x)
172 end 172 end
173end 173end
174 174
175function m.isatom (x)
176 if x == m.null then
177 return true -- '() is the only value that is both atom and list
178 elseif m.luatype(x) == "table" then
179 -- generally, anything that's implemented as a table is *not* an
180 -- atom, at least as I will define it. (it's not an actual
181 -- scheme procedure)
182 return false
183 else
184 return true
185 end
186end
187
175-------- 188--------
176return m 189return m