Why does this work?
(defrecord R [k])
(extend-protocol P R (p [{:keys [k]}] k))On Fri, Apr 30, 2010 at 2:52 PM, Sean Devlin <[email protected]>wrote: > I think you have your destructuring backwards. > > You fn should probably be (fn [{k :keys}] k) > > For example, > > user=> ((fn [{k :keys}] k) {:keys "Awesome"}) > "Awesome" > > > > On Apr 30, 2:46 pm, russellc <[email protected]> wrote: > > Should this compile? > > > > (defprotocol P (p [this])) > > (defrecord R [k] P (p [{:keys [k]}] k)) > > > > java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot > > be cast to clojure.lang.Symbol > > > > -- > > 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]<clojure%[email protected]> > > For more options, visit this group athttp:// > 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 [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]<clojure%[email protected]> > 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 [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
