On 5 August 2010 15:52, Stuart Halloway <stuart.hallo...@gmail.com> wrote: > If records implemented IFn, you could treat them as collections, which they > are not.
Lists are collections, yet they are not IFns. Same goes for Java collections. As for records, the implementation seems to be in two minds about their status: user=> (defrecord Foo []) user.Foo user=> (instance? clojure.lang.IPersistentCollection (Foo.)) true user=> (instance? java.util.Collection (Foo.)) false I have to say that I am mildly disturbed by the fact that an IPersistentCollection might not be a Collection... (Also, the above is meant to supplement Laurent's examples.) The word "record", to me, suggests a collection of information on a single "master entity", rather than just any bunch of random things, so not having records implement IFn by default seems to be in line with idea that (:foo obj) should be used for something like generalised field access, whereas (coll :foo) is precisely for dealing with "bunches of random things" (that's my understanding, anyway). Does the fact that something implements j.u.Collection create an expectation that it is meant for holding "a bunch of random things"? If so, does this not apply to IPersistentCollection? (Also, is this another instance of the "only so many good names" problem? :-)) 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