> I just read: > > http://clojure.org/reader > > Metadata (^) > Metadata is a map associated with some kinds of objects: Symbols, Lists, > Vector, Sets, Maps, tagged literals returning an IMeta, and record, type, and > constructor calls. The metadata reader macro first reads the metadata and > attaches it to the next form read (see with-meta to attach meta to an object): > ^{:a 1 :b 2} [1 2 3] yields the vector [1 2 3] with a metadata map of {:a 1 > :b 2}. > > Ok, but how the reader works?
The description above is literally how it works: "The metadata reader macro first reads the metadata and attaches it to the next form read". Reader macros are implemented within the reader. They are distinct from defmacro macros. The implementation is here: https://github.com/clojure/clojure/blob/clojure-1.6.0/src/jvm/clojure/lang/LispReader.java#L706 The reader reads from an input stream; it: - reads the metadata object, meta [L716] - reads the object that follows it, o [L724] - figures out how to apply meta to o based on the interface(s) o implements [L725.L731] - applies meta to o [L733,L741] --Steve -- 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.