diff options
author | Case Duckworth | 2024-02-22 00:29:23 -0600 |
---|---|---|
committer | Case Duckworth | 2024-02-22 00:29:23 -0600 |
commit | 34d94104686fdb6e3bc2573315291770cab37cf3 (patch) | |
tree | 847181cf70c590ea1735586295583fa138102bc0 /types.lua | |
parent | Add global and types libraries (diff) | |
download | lam-34d94104686fdb6e3bc2573315291770cab37cf3.tar.gz lam-34d94104686fdb6e3bc2573315291770cab37cf3.zip |
Change types to lowercase; add todos
Diffstat (limited to 'types.lua')
-rw-r--r-- | types.lua | 13 |
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 | ||
7 | function types.lamtype (x) | 7 | function 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 |
19 | end | 19 | end |
20 | 20 | ||
21 | types["number?"] = function (x) return types.lamtype(x) == "Number" end | 21 | types["number?"] = function (x) return types.lamtype(x) == "number" end |
22 | types["symbol?"] = function (x) return types.lamtype(x) == "Symbol" end | 22 | types["symbol?"] = function (x) return types.lamtype(x) == "symbol" end |
23 | types["list?"] = function (x) return types.lamtype(x) == "List" end | 23 | types["list?"] = function (x) return types.lamtype(x) == "list" end |
24 | types["procedure?"] = function (x) return types.lamtype(x) == "procedure" end | ||
24 | types["null?"] = function (x) return x == {} end | 25 | types["null?"] = function (x) return x == {} end |
25 | 26 | ||
26 | --- | 27 | --- |