ClojureDocs

Nav

Namespaces

prefers

clojure.core

Available since 1.0 (source)
  • (prefers multifn)
Given a multimethod, returns a map of preferred value -> set of other values
1 Example
(def m {:os ::osx})

(defmulti ex :os)

(defmethod ex ::unix
  [_]
  "unix")

(derive ::osx ::unix)

(defmethod ex ::bsd
  [_]
  "bsd")

(derive ::osx ::bsd)

(prefer-method ex ::unix ::bsd)

(prefers ex)
;;=> {:user/unix #{:user/bsd}}
See Also

Causes the multimethod to prefer matches of dispatch-val-x over dispatch-val-y when there is a c...

Added by abrooks

Given a multimethod, returns a map of dispatch values -> dispatch fns

Added by abrooks

Given a multimethod and a dispatch value, returns the dispatch fn that would apply to that value, ...

Added by abrooks
0 Notes
No notes for prefers