From 43b3c83967b84a80dbd1527be7ec39234d89bfce Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 3 Apr 2024 22:48:42 -0500 Subject: Add isatom() --- type.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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) end end +function m.isatom (x) + if x == m.null then + return true -- '() is the only value that is both atom and list + elseif m.luatype(x) == "table" then + -- generally, anything that's implemented as a table is *not* an + -- atom, at least as I will define it. (it's not an actual + -- scheme procedure) + return false + else + return true + end +end + -------- return m -- cgit 1.4.1-21-gabe81