>From your comments, I suspect this may be a source of confusion as well:
When you have something like (defn ^{:doc "Increments"} a-fn [x] (+ x 1)) the metadata is attached to the symbol at read time. However, during the compilation process, the metadata on the symbol is transferred to the Var that holds the function created. If you want to access this metadata you have to access the Var itself, not the function. user=> (meta a-fn) nil user=> (meta #'a-fn) {:ns #<Namespace user>, :name a-fn, :file "NO_SOURCE_PATH", :column 1, :line 1, :arglists ([x]), :doc "Increments"} The #' syntax is shorthand for accessing the Var. You can see this process in the following code: (let [fn-def-sym (with-meta 'b-fn {:here true}) fn-def-code `(defn ~fn-def-sym [x#] (+ x# 1))] (eval fn-def-code)) #'user/b-fn user=> (b-fn 2) 3 user=> (meta b-fn) nil user=> (meta #'b-fn) {:ns #<Namespace user>, :name b-fn, :file "NO_SOURCE_PATH", :here true, :column 1, :line 1, :arglists ([x__769__auto__])} The important thing here is that the definition code is manually built up using a symbol that has metadata given manually, which is then transferred to a Var when the code is evaluated. On Tuesday, May 5, 2015 at 1:31:40 PM UTC-5, Andrey Antukh wrote: > > Hi! > > I have some trouble with clojure metadata / reader and I do not know if > I'm doing something wrong. > > I have this code: > > (defn some-func []) > > (def func ^:abc some-func) > > (assert (= (meta func) {:abc true})) > > (def data [[:bar (with-meta some-func {:abc true})] > [:baz ^:abc some-func]]) > > (assert (= (meta (get-in data [0 1])) {:abc true})) > (assert (= (meta (get-in data [1 1])) {:abc true})) > > It fails in the first assert and in the last (if I comment the first one > obviously). I do not understand why that form of metadata does not works > as I expect (http://clojure.org/metadata) > > Thank you very much. > > Regards. > Andrey > > -- > Andrey Antukh - Андрей Антух - <andrei....@kaleidos.net <javascript:>> / < > ni...@niwi.be <javascript:>> > http://www.niwi.be <http://www.niwi.be/page/about/> > https://github.com/niwibe > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.