feat: add Dynamic.proc? (#1278)

This commit is contained in:
Veit Heller 2021-07-13 18:04:58 +02:00 committed by GitHub
parent 092b249ac7
commit 74d64a85bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,12 @@
(defmodule Dynamic
;; 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.")
(defdynamic nil '())