Previously discussed here https://groups.google.com/forum/?fromgroups=#!searchin/clojure/plural/clojure/KC-zfUE1rXk/ifURo1ReSugJ
In that thread, Chris Ford talked about opening up the implementation of the dispatch function of multimethods. I've implemented that idea but I go further to decomplect the datastructure and resolving algorithm. Also I've decomplected state (identity), as plural-fns are immutable values. To reduce the number of protocols generated, I'm using metadata to enable extensibility (defining additional methods). Code is found here: https://github.com/bmillare/dj.plurality You should notice that the implementation is almost nothing. The core of plural-fns is in the specification as the only real helper function I provide is "update-implementation". I've provided a basic multimethod implementation without hiearchies (perhaps merge work with brandon bloom? https://github.com/brandonbloom/dispatch-map/tree/master/src/dispatch_map). I've also hacked together a naive predicate dispatching system using David Nolen's core.match. I'm interested in feedback. Simple example: (require '[dj.plurality :as dp]) (let [x (dp/->simple-multi-fn {java.lang.Long inc} type) y (dp/update-implementation x assoc java.lang.Double dec)] [(x 3) (y 3.0) (y 1)]) => [4 2.0 2] -- 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