vendredi 19 janvier 2018

Reflect on Clojure Function Name

How do I use reflection in Clojure to extract the function name of a symbol that evaluates to a function?

(require '[clojure.reflect :as r])
(defn foo [x] x)
(r/reflect foo)
=> {#clojure.reflect.Field ... 'gobbledygook}

Something about (map :name (:members (r/reflect foo)))?





Aucun commentaire:

Enregistrer un commentaire