Hi,
I have a multimethod which is dispatched on two arguments:

(defmulti bar (fn [x y] [x y]))
(defmethod bar [1 2] ..)
(defmethod bar [3 4] ..)

Is there a way I can define methods on this which use "wildcards"?

E.g.:

; To match any call with 42 as the 1st argument
(defmethod bar [42 _] ..)

; To match any call with 16 as the 2nd argument
(defmethod bar [_ 16] ..)

The above syntax doesn't seem to work, neither does using ':default'
in place of the '_'.

If this is not possible, is there a common pattern I should implement instead?


-- 
Paul Richards
@pauldoo

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