diff options
author | Case Duckworth | 2024-04-03 22:48:42 -0500 |
---|---|---|
committer | Case Duckworth | 2024-04-03 22:48:42 -0500 |
commit | 43b3c83967b84a80dbd1527be7ec39234d89bfce (patch) | |
tree | 45050e8224e1aec8b7d90b5d9a379beae29dae71 | |
parent | Update tests and readme (diff) | |
download | lam-43b3c83967b84a80dbd1527be7ec39234d89bfce.tar.gz lam-43b3c83967b84a80dbd1527be7ec39234d89bfce.zip |
Add isatom()
-rw-r--r-- | type.lua | 13 |
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 |
173 | end | 173 | end |
174 | 174 | ||
175 | function 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 | ||
186 | end | ||
187 | |||
175 | -------- | 188 | -------- |
176 | return m | 189 | return m |