Consider
(defn f ^{:foo "bar"} [x] (* x x))
and
(defn g #^{:foo "bar"} [x] (* x x))
Both compile and run.
I have two questions: first, why do (meta f)
and (meta g)
produce only nil
? I would have expected them to produce {:foo "bar"}
; i.o.w., am I just completely out to lunch on metadata and have I defined some kind of garbage out there?
Second, what is the difference between the two syntaces for the metadata? It looks like the second one is a "tagged literal," something to do with edn, the extended data notation, but I can't quite noodle it out without some more context or examples.