mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-26 05:45:37 +03:00
feat: add Dynamic.proc? (#1278)
This commit is contained in:
parent
092b249ac7
commit
74d64a85bb
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
(defmodule Dynamic
|
(defmodule Dynamic
|
||||||
;; Functions for doing things at the REPL and during compile time.
|
;; Functions for doing things at the REPL and during compile time.
|
||||||
|
(doc proc? "checks whether `x` is callable.")
|
||||||
|
(defndynamic proc? [x]
|
||||||
|
(or
|
||||||
|
(List.in? (dynamic-type x) '(fn closure))
|
||||||
|
(let [s (s-expr x)]
|
||||||
|
(and (not (empty? s)) (= 'dynamic (dynamic-type (car s)))))))
|
||||||
|
|
||||||
(doc nil "is the value `nil`, i.e. the empty list.")
|
(doc nil "is the value `nil`, i.e. the empty list.")
|
||||||
(defdynamic nil '())
|
(defdynamic nil '())
|
||||||
|
Loading…
Reference in New Issue
Block a user