about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-04-11 23:02:27 -0500
committerCase Duckworth2024-04-11 23:02:27 -0500
commit71fb7a4ea8524928f9ed3cec6983a9f2be38d3c6 (patch)
tree2100445c0028ff476692a9ea40e4b6bb4aa06398
parentAdd -> functions to core (diff)
downloadlam-71fb7a4ea8524928f9ed3cec6983a9f2be38d3c6.tar.gz
lam-71fb7a4ea8524928f9ed3cec6983a9f2be38d3c6.zip
Add listp to assert_type
-rw-r--r--type.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/type.lua b/type.lua index cf24d0c..6dbf313 100644 --- a/type.lua +++ b/type.lua
@@ -266,7 +266,9 @@ end
266 266
267-- type assertion 267-- type assertion
268function m.assert_type (x, t) 268function m.assert_type (x, t)
269 if not m.isp(x, t) then 269 local pred = function (a) return m.isp(a, t) end
270 if t == "list" then pred = m.listp end
271 if not pred(x) then
270 error("wrong type", m.lamtype(x), t) 272 error("wrong type", m.lamtype(x), t)
271 end 273 end
272end 274end