On Tue, Feb 14, 2012 at 3:14 PM, László Török <ltoro...@gmail.com> wrote:

> What I don't get is how a (class []) gets dispatched to ::collection.
>
> (class []) returns clojure.lang.PersistentVector which doesn't seem to
> satisfy the isa? relationship.
>
> (defmulti foo class)
> (defmethod foo ::collection [c] :a-collection)
> (defmethod foo String [s] :a-string)
>
> (foo [])
> :a-collection
>
> (foo (java.util.HashMap.))
> :a-collection
>
> (foo "bar")
> :a-string

This is depending on the line earlier in the page that did:

(derive java.util.Collection ::collection)

-- 
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