This sounds interesting. I tried to define a multimethod in one file and a
method in another file. I had no success.
--
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
It does work.
As far as I can tell, the namespace with defmethod must require the
namespace with defmulti and also the namespace with defmethod must be
required from some other namespace that is being executed.
Eg:
*foo.clj:*
(ns foo)
(defmulti mmtest identity)
(defmethod mmtest :default [_]
This cleared it up, 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
Case only works with ints keywords and some other literals (including
lists, but don't do that, since it doesn't do what you think it does).
While multi-methods work on pretty much anything:
(defmulti first-of-both (fn [a b]
[(first a) (first b)]))
(defmethod
Is there any documentation or do you have thoughts on choosing between
using multimethods vs case? I assume they both do constant time dispatch.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Use multimethods if you want to open the system up for later extension
(by a library user, for example).
Elric Erkose mailto:elric.erk...@gmail.com
July 8, 2014 at 2:02 PM
Is there any documentation or do you have thoughts on choosing between
using multimethods vs case? I assume they both do