Re: [question] Multimethods vs case

2014-07-10 Thread Elric Erkose
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

Re: [question] Multimethods vs case

2014-07-10 Thread Daniel Kersten
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 [_]

Re: [question] Multimethods vs case

2014-07-10 Thread Elric Erkose
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

Re: [question] Multimethods vs case

2014-07-10 Thread Timothy Baldridge
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

[question] Multimethods vs case

2014-07-08 Thread Elric Erkose
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

Re: [question] Multimethods vs case

2014-07-08 Thread Sam Ritchie
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