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
You are looking for resolve,
(resolve (symbol "asd"))
returns nil
(resolve (symbol "filter"))
return #'clojure.core/filter
To check if a var is a function (credit goes to @amalloy):
(-> s symbol resolve deref ifn?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With