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 <francoisdev...@gmail.com>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 <russell.christop...@gmail.com> 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 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 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 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

Reply via email to