I think record doen't implements all the stuff a PersistentMap implementes. It implementes the interface for map-lookup (with get and :foo) but doesn't implements IFn (for using an instance as a function).
On Tue, Jun 29, 2010 at 9:16 PM, Daniel Gagnon <[email protected]> wrote: > Under the latest snapshot of the equiv branch (07f05862c2), if I create a > record: > (defrecord MyRecord [foo bar baz]) > and then create a record out of it: > (def x (MyRecord. 1 2 3)) > I can use a keyword as a function to get the data: > (:foo x) > 1 > But if I use the record as a function like I would for a map, I get an > error: > (x :foo) > java.lang.ClassCastException: user.MyRecord cannot be cast to > clojure.lang.IFn > Is that a bug or is there something I don't get about records? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > 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 -- Moritz Ulrich Programmer, Student, Almost normal Guy http://www.google.com/profiles/ulrich.moritz -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. 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
