On Jun 7, 7:46 pm, Peter Salvi <salvipe...@gmail.com> wrote:
> (defmethod foo [:bar :anything] [a b] ...)
> (defmethod foo [:anything :baz] [a b] ...)
> (defmethod foo [:bar :baz] [a b] ...)
>
> This seems to do the trick... but is this really the way to do it?

This looks reasonable.

> If it is, it would be very useful to have something that is the
> ancestor of everything (like T in common lisp).

This has been thought about, at least: http://clojure.org/todo
I think the question is... what should the universal ancestor be?  For
classes, it's java.lang.Object.  But "derive" allows you to create
relationships outside the Java class hierarchy.  So for now, defining
your own "root" ancestor is the way to proceed.

-Stuart Sierra
--~--~---------~--~----~------------~-------~--~----~
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