On Jul 28, 2012, at 4:36 PM, Vinzent wrote:

> 
> robert.hooke works fine with multimethods: 
> 
> user=> (defmulti foo class) 
> nil 
> user=> (defmethod foo :default [x] (str x)) 
> #<MultiFn clojure.lang.MultiFn@7539f0bb> 
> user=> (require '[robert.hooke :refer (add-hook)]) 
> nil 
> user=> (add-hook #'foo (fn [f & [x]] (str "K: " (f x)))) 
> (#<user$eval3072$fn__3074 user$eval3072$fn__3074@534b58c>) 
> user=> (foo 42) 
> "K: 42" 
> 
> foo is a plain function now.

Oh, right, good point.  I've generally used hooks to modify others' 
multimethods, and so I suppose I've been lucky to always apply the hook after 
all methods had been registered.

- Chas

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