how can i know if a function name provided as string is callable or not in the current context? something like:
(callable? "asdasd") ;; false
(callable? "filter") ;; true
thanks
how can i know if a function name provided as string is callable or not in the current context? something like:
(callable? "asdasd") ;; false
(callable? "filter") ;; true
thanks
Chances are if you need this, you're doing something wrong, but...
You are looking for resolve,
returns nil
return #'clojure.core/filter
To check if a var is a function (credit goes to @amalloy):
UPD. I found out that
fn?
checks only for interfaceFn
and doesn't work for resolved symbol. Though,clojure.test/function?
does what is needed, so I updated an example.