mirror of
https://github.com/kanaka/mal.git
synced 2024-09-17 16:47:22 +03:00
make, miniMAL: add number?, fn? and macro?
This commit is contained in:
parent
14a5c0d8bc
commit
b156d1f145
@ -76,7 +76,8 @@ subs = $(strip \
|
||||
|
||||
|
||||
# Function functions
|
||||
function? = $(if $(call _function?,$(1)),$(__true),$(__false))
|
||||
fn? = $(if $(call _function?,$(1)),$(if $(_macro_$(1)),$(__false),$(__true)),$(__false))
|
||||
macro? = $(if $(_macro_$(1)),$(__true),$(__false))
|
||||
|
||||
|
||||
# List functions
|
||||
@ -239,7 +240,9 @@ core_ns = type obj_type \
|
||||
symbol? symbol? \
|
||||
keyword keyword \
|
||||
keyword? keyword? \
|
||||
function? function? \
|
||||
number? number? \
|
||||
fn? fn? \
|
||||
macro? macro? \
|
||||
\
|
||||
pr-str pr_str \
|
||||
str str \
|
||||
@ -249,7 +252,6 @@ core_ns = type obj_type \
|
||||
read-string read_str \
|
||||
slurp slurp \
|
||||
subs subs \
|
||||
number? number? \
|
||||
< number_lt \
|
||||
<= number_lte \
|
||||
> number_gt \
|
||||
|
@ -121,6 +121,14 @@
|
||||
["`", "symbol?"], "symbol?",
|
||||
["`", "keyword"], "keyword",
|
||||
["`", "keyword?"], "keyword?",
|
||||
["`", "number?"], "number?",
|
||||
["`", "fn?"], ["fn", ["a"],
|
||||
["or", ["function?", "a"],
|
||||
["and", ["malfunc?", "a"],
|
||||
["not", ["get", "a", ["`", "macro?"]]]]]],
|
||||
["`", "macro?"], ["fn", ["a"],
|
||||
["and", ["malfunc?", "a"],
|
||||
["get", "a", ["`", "macro?"]]]],
|
||||
|
||||
["`", "pr-str"], ["fn", ["&", "a"], ["pr-list", "a", true, ["`", " "]]],
|
||||
["`", "str"], ["fn", ["&", "a"], ["pr-list", "a", false, ["`", ""]]],
|
||||
|
@ -31,6 +31,10 @@
|
||||
["=", ["`", "String"],
|
||||
[".-", [".-", "a", ["`", "constructor"]],
|
||||
["`", "name"]]]]]],
|
||||
["def", "number?", ["fn", ["a"],
|
||||
["=", ["`", "[object Number]"], ["classOf", "a"]]]],
|
||||
["def", "function?", ["fn", ["a"],
|
||||
["isa", "a", "Function"]]],
|
||||
|
||||
["def", "pr-list*", ["fn", ["a", "b", "c"],
|
||||
[".", ["map", ["fn", ["x"],
|
||||
|
Loading…
Reference in New Issue
Block a user