Hello
What is the idiomatic way to implement the classic collide-with
function in Clojure?
I would like to implement something similar to the following (pseudo
code ahead):

(defmulti collide-with foo)

(defmethod collide-with ["asteroid" "spaceship"] (print "Boom"))
(defmethod collide-with ["asteroid" any] (print " Wiiissh"))
(defmethod collide-with [any "spaceship"] (print "Wooossh"))
(defmethod collide-with [any any] (print "Dead Space"))

The idea is to have a default function for a collision of asteroid
with anything else, and of spaceship with anything else.
What foo can I use?

Thanks

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