(multimethod source name)
creates a multimethod from an existing one
(defmulti hello :type)
(defmethod hello :a [e] (assoc e :a 1))
(def world (multimethod hello "world"))
(defmethod world :b [e] (assoc e :b 2))
(world {:type :b}) => {:type :b :b 2}
;; original method should not be changed (hello {:type :b}) => (throws)
creates a multimethod from an existing one (defmulti hello :type) (defmethod hello :a [e] (assoc e :a 1)) (def world (multimethod hello "world")) (defmethod world :b [e] (assoc e :b 2)) (world {:type :b}) => {:type :b :b 2} ;; original method should not be changed (hello {:type :b}) => (throws)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close