> What is it supposed to do? What's the usage look like? > Oh right, a description would be useful. The point is to build up the functionality of a function from several places. You define a hook function:
(defhook foo [a b]) Initially, it does nothing. Then, other code can add hooks: (add-hook foo :first-hook (fn [a b] (println "first!"))) The hooks should all have the same signature as in defhook. You can add as many as you like. The second argument is a "name", so you can remove the hook later if desired. (add-hook foo :second (fn [a b] (println "a=" a "b=" b))) Then, call the function, and all of the hooks get called in the order added user> (foo 1 2) first! a= 1 b= 2 nil There's also a function, remove-hook, that works about the way you'd expect. (remove-hook foo :first-hook) > Why does defhook's signature arg never get used? > It'd also help readability to wrap your doc string. This is just a sketch. I meant for the signature to go into the arglist metadata of the def'd var, but couldn't get it to work in 5 minutes, and gave up on it (for now). I plan on doing all of that polishing, assuming nobody tells me it's not evil. Honestly, I'm not sure yet, but it seems to work well for Emacs, and I couldn't think of a better alternative for my own Clojure problem. Allen -- 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