From 71fb7a4ea8524928f9ed3cec6983a9f2be38d3c6 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 11 Apr 2024 23:02:27 -0500 Subject: Add listp to assert_type --- type.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/type.lua b/type.lua index cf24d0c..6dbf313 100644 --- a/type.lua +++ b/type.lua @@ -266,7 +266,9 @@ end -- type assertion function m.assert_type (x, t) - if not m.isp(x, t) then + local pred = function (a) return m.isp(a, t) end + if t == "list" then pred = m.listp end + if not pred(x) then error("wrong type", m.lamtype(x), t) end end -- cgit 1.4.1-21-gabe81