Liking cljdoc? Tell your friends :D

hara.function.base.multi


multi-addclj

(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
raw docstring

multi-cloneclj

(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)
raw docstring

multi-getclj

(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?
raw docstring

multi-has?clj

(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
raw docstring

multi-keysclj

(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}
raw docstring

multi-listclj

(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))
raw docstring

multi-match?clj

(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)
raw docstring

multi-removeclj

(multi-remove multi dispatch)

removes an entry

(multi-remove world :b) => fn?

removes an entry

(multi-remove world :b)
=> fn?
raw docstring

multi?clj

(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
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close