Hi, On Dec 8, 8:36 am, Tzach <tzach.livya...@gmail.com> wrote:
> I didn't know the costume hierarchy at all, it seems to be very > useful. > I understand it is coupled to the Java object hierarchy. Not at all. Have a look at the docstrings, eg. of derive and isa?. Even in my example ::Asteroid and ::Spaceship are not Java classes but simply qualified keywords. To use: (with-meta {:engines 4 :lasers 2 :shields :ion} {:type ::Spaceship})... > Is there a way to create similar util for strings, as I did on my > first example? For strings this is not possible, since you can't use it in derive. So there is no bottom type possible. You would have to do: (defmethod collide-with ["asteroid" "spaceship"] ...) (defmethod collide-with ["asteroid" "comet"] ...) (defmethod collide-with ["asteroid" "asteroid"] ...) (defmethod collide-with ["asteroid" "jupiter"] ...) .... Sincerely Meikel -- 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