2010/8/5 Stuart Halloway <stuart.hallo...@gmail.com> > If records implemented IFn, you could treat them as collections, which they > are not. >
Isn't the fact of making records associative for easing the use of treating them as collections ? user=> (assoc (user.R. 1) :b 2) #:user.R{:a 1, :b 2} user=> (seq (user.R. 1)) ([:a 1]) user=> > There is an asymmetry here: Maps can be used as (impoverished but easy) > records, but the reverse is not true: > > (:foo x) ; x is logically a record (though might be a map for simplicity). > (x :foo) ; x is a collection (not a record, entity, etc.) > > Records not implementing IFn forces you to do what you should do anyway -- > access records with the keyword first. > > Stu > > >> Hi BG, >> It is a common mistake to think that callability, corresponding to the >> clojure.lang.IFn interface, is part of the persistent map contract >> (I've done it myself, as did many others a Conj labs :). It is not. It >> is actually just a feature of clojure.lang.PersistentHashMap (and the >> other clojure map implementations). >> >> > While I get that part, I wonder why records do not implement IFn, it'd be > convenient if they did. > > -- > 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 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<clojure%2bunsubscr...@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 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