Hi, On 6 Sep., 06:14, Sunil S Nandihalli <sunil.nandiha...@gmail.com> wrote:
> (defmethod foo [_ :hello _ _ ] (str "I'm method 1")) > (defmethod foo [:world _ :us _ ] (str "I'm method 2")) > (defmethod foo [:city _ :us _ ] (str "I'm method 3")) You can use qualified keywords with an hierarchy. (def your-hierarchy (-> (make-hierarchy) (derive ::hello ::anything) (derive ::world ::anything) (derive ::city ::anything) (derive ::us ::anything))) (defmulti foo your-dispatch-fn-here :hierarchy your-hierarchy) (defmethod foo [::anything ::hello ::anything ::anything] (str "I'm method 1")) (defmethod foo [::world ::anything ::us ::anything] (str "I'm method 2")) (defmethod foo [::city ::anything ::us ::anything] (str "I'm method 3")) Sincerely Meikel -- 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