(multi-add multi dispatch-val method)
adds an entry to the multimethod
(multi-add world :c (fn [m] (assoc m :c 3))) => world
adds an entry to the multimethod (multi-add world :c (fn [m] (assoc m :c 3))) => world
(multi-clone source name)
creates a multimethod from an existing one
(defmulti hello :type)
(defmethod hello :a [m] (assoc m :a 1))
(def world (multi-clone hello "world"))
(defmethod world :b [m] (assoc m :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 [m] (assoc m :a 1)) (def world (multi-clone hello "world")) (defmethod world :b [m] (assoc m :b 2)) (world {:type :b}) => {:type :b :b 2} ;; original method should not be changed (hello {:type :b}) => (throws)
(multi-get multi dispatch)
returns all entries in the multimethod
(multi-get world :b) => fn?
returns all entries in the multimethod (multi-get world :b) => fn?
(multi-has? multi val)
returns true
if the multimethod contains a value for dispatch
(multi-has? print-method Class) => true
returns `true` if the multimethod contains a value for dispatch (multi-has? print-method Class) => true
(multi-keys multi)
returns all keys for a given multimethod
(multi-keys world) => #{:a :b}
returns all keys for a given multimethod (multi-keys world) => #{:a :b}
(multi-list multi)
returns all entries in the multimethod
(multi-list world) => (satisfies [:a :b] (comp vec sort keys))
returns all entries in the multimethod (multi-list world) => (satisfies [:a :b] (comp vec sort keys))
(multi-match? multi method)
(multi-match? multi method throw?)
checks if the multi dispatch matches the arguments
(multi-match? (.dispatchFn string/-from-string) (fn [_ _ _])) => true
(multi-match? (.dispatchFn string/-from-string) (fn [_]) true) => (throws)
checks if the multi dispatch matches the arguments (multi-match? (.dispatchFn string/-from-string) (fn [_ _ _])) => true (multi-match? (.dispatchFn string/-from-string) (fn [_]) true) => (throws)
(multi-remove multi dispatch)
removes an entry
(multi-remove world :b) => fn?
removes an entry (multi-remove world :b) => fn?
(multi? obj)
returns true
if obj
is a multimethod
(multi? print-method) => true
(multi? println) => false
returns `true` if `obj` is a multimethod (multi? print-method) => true (multi? println) => false
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close