Hi Paul, On 23 Okt., 15:11, Paul Drummond <[EMAIL PROTECTED]> wrote: > I am a bit puzzled by how metadata seems to behave differently > depeding on where it's used and whether #^ is included or not:
AFAIU, #^ attaches the given map to the thing read. > (defn #^{:doc "doc"} my-fn ([x] x)) > ;;Works Attaches {:doc "doc"} to the metadata of the symbol my-fn. > (defn {:doc "doc"} my-fn ([x] x)) > ;;Error: Second argument to def must be a Symbol Obviously #^ is missing, hence the map is passed on to defn. Defn expects a Symbol not a Map. => *meep* > (defn my-fn [x] x #^{:doc "doc"}) > ;;Error: Unmatched delimiter: ) Since #^ attaches to the next thing read and there is nothing following the reader screws up in some way. > (defn my-fn ([x] x) {:doc "doc"}) > ;;Works This is the syntax of defn, I believe. What ever map you pass at the end of the definition is added to the meta-data. > Can anyone help me understand this please? I'm not sure understand this meta-data stuff myself... Sincerely Meikel --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---