Re: Problems getting function metadata

2014-03-14 Thread Jozef Wagner
Metadata can be attached to many kinds of objects: functions, vars, collections, references, etc. Metadata added in defn is added to the global Var which is holding the newly created function. user=> (defn ^{:foo 42} my-fn []) #'user/my-fn user=> (:foo (meta #'my-fn)) ;; same as (:foo (meta (v

Re: Problems getting function metadata

2014-03-14 Thread Mauricio Aldazosa
With your first example you obtain the metadata of the var (that's the place where defn stores the metadata). In the second one, take a look at the value that is stored in the map: user> (:function fun-map) # Thats the func

Problems getting function metadata

2014-03-14 Thread Adam Krieg
I'm trying to get the meta data off a function that was stored in a map, (defn my-fun [x] x) (def fun-map {:function my-fun}) (meta (var my-fun)) ; this works (meta (var (:function fun-map))) ; This fails with CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot b