(isa? [String String] [Object Object]) returns true. This is nice and 
useful.

However

(isa? '(String String) '(Object Object) returns false, this is not so nice.

(isa? '(String String) [Object Object]) also return false.


So the moral of the story is that for multiple argument dispatch to work, I 
need to use 'mapv' instead of 'map' in my dispatch function, which I have 
done.
But it was sort of a pain to find out the hard way (i.e. time spent 
debugging) that 'map' won't work in this regard.

I.e. this fails:

(defmulti foo (fn [ & args ] (map class args)))
(defmethod foo [Object Object] [a b] (println a b))
(foo "a" "b")
IllegalArgumentException No method in multimethod 'foo' for dispatch value: 
clojure.lang.LazySeq@86465241  clojure.lang.MultiFn.getFn (MultiFn.java:160)

but this works:

(defmulti bar (fn [ & args ] (mapv class args)))
(defmethod bar [Object Object] [a b] (println a b))
(bar "a" "b")
a b

Bug or feature?

Clojure 1.5.1


-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to