about summary refs log tree commit diff stats
path: root/types.lua
diff options
context:
space:
mode:
Diffstat (limited to 'types.lua')
-rw-r--r--types.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/types.lua b/types.lua index dd105cf..d4c8d14 100644 --- a/types.lua +++ b/types.lua
@@ -6,21 +6,22 @@ types.luatype = type
6 6
7function types.lamtype (x) 7function types.lamtype (x)
8 if types.luatype(x) == "string" then 8 if types.luatype(x) == "string" then
9 return "Symbol" 9 return "symbol"
10 elseif types.luatype(x) == "number" then 10 elseif types.luatype(x) == "number" then
11 return "Number" 11 return "number"
12 elseif getmetatable(x) and getmetatable(x).__type then 12 elseif getmetatable(x) and getmetatable(x).__type then
13 return getmetatable(x).__type 13 return getmetatable(x).__type
14 elseif types.luatype(x) == "table" then 14 elseif types.luatype(x) == "table" then
15 return "List" 15 return "list"
16 else 16 else
17 return types.luatype(x) 17 return types.luatype(x)
18 end 18 end
19end 19end
20 20
21types["number?"] = function (x) return types.lamtype(x) == "Number" end 21types["number?"] = function (x) return types.lamtype(x) == "number" end
22types["symbol?"] = function (x) return types.lamtype(x) == "Symbol" end 22types["symbol?"] = function (x) return types.lamtype(x) == "symbol" end
23types["list?"] = function (x) return types.lamtype(x) == "List" end 23types["list?"] = function (x) return types.lamtype(x) == "list" end
24types["procedure?"] = function (x) return types.lamtype(x) == "procedure" end
24types["null?"] = function (x) return x == {} end 25types["null?"] = function (x) return x == {} end
25 26
26--- 27---