Thanks Michał You did understand my intention, and it was the former non-existent case I was referring to.
I wanted to attach metadata about type, field arity etc in the definition of the record type so that I could write some tools to do intelligent conversion between record structures. Charles. On Jul 11, 3:15 pm, Michał Marczyk <michal.marc...@gmail.com> wrote: > On 11 July 2010 14:30, Quzanti <quza...@googlemail.com> wrote: > > > Please could someone tell me the preferred way of attaching field > > (key?) specific metadata in a defrecord definition? > > I'm not sure if I understand your intention correctly, but if I do, > then there is no such thing. If the fields of a particular instance of > your record hold objects which can have metadata attached to them, you > can of course create a new instance of your record type with any such > objects replaced with copies with new metadata attached. > > (defrecord Foo [x y]) > > (defn set-x-meta [foo x-meta] > (Foo. (with-meta (.x foo) x-meta) y)) > > > And how to I extract this metadata on a field by field basis? > > (meta (.x foo)) > > Sincerely, > Michał -- 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