On Oct 23, 9:11 am, Paul Drummond
Sure. #^ is reader syntax for metadata. It adorns the following thing
read, it is not a thing unto itself. So,
#^{:doc "doc"} my-fn
is read all together as one thing, a symbol named my-fn, having the
metadata map {:doc "doc"}. Putting #^{:doc "doc"} at the end of a
list is metadata adorning nothing, and thus an error.
defn's internal syntax supports map literal forms, which are added as
metadata on the resulting var, but are not metadata literals in the
source.
The important thing to understand is how the reader works first,
producing a data structure which is them processed by any macros or
the compiler.
Read as list of symbol symbol list:
(defn #^{:doc "doc"} my-fn ([x] x))
Read as list of symbol map symbol list:
(defn {:doc "doc"} my-fn ([x] x))
Rich