Liking cljdoc? Tell your friends :D

methodical.impl.dispatcher.common

Utility functions for implementing Dispatchers.

Utility functions for implementing Dispatchers.
raw docstring

add-preferenceclj

(add-preference isa?* prefs x y)

Add a method preference to prefs for dispatch value x over y. Used to implement prefer-method. isa?* is used to determine whether a relationship between x and y that precludes this preference already exists; it can be clojure.core/isa?, perhaps partially bound with a hierarchy, or some other 2-arg predicate function.

Add a method preference to `prefs` for dispatch value `x` over `y`. Used to implement `prefer-method`. `isa?*` is
used to determine whether a relationship between `x` and `y` that precludes this preference already exists; it can
be `clojure.core/isa?`, perhaps partially bound with a hierarchy, or some other 2-arg predicate function.
sourceraw docstring

ambiguous?clj

(ambiguous? hierarchy prefs dispatch-value dispatch-val-x dispatch-val-y)

True if neither dispatch-val-x nor dispatch-val-y dominate one another, e.g. because they are the same value or are both equally-specific ancestors.

True if neither `dispatch-val-x` nor `dispatch-val-y` dominate one another, e.g. because they are the same value or
are both equally-specific ancestors.
sourceraw docstring

distinct-byclj

(distinct-by f coll)

Like distinct, but uses value of (f item) to determine whether to keep each item in the resulting collection.

Like `distinct`, but uses value of `(f item)` to determine whether to keep each `item` in the resulting collection.
sourceraw docstring

dominates?clj

(dominates? hierarchy prefs x y)
(dominates? hierarchy prefs default-dispatch-value x y)

True if dispatch value x should be considered more specific for purposes of method combination over dispatch value y, e.g. because x derives from y, or because x (or one of its ancestors) has been explicitly preferred over y (or one of its ancestors).

4-arity version does not take the default-dispatch-value into account, but 5-arity version does.

True if dispatch value `x` should be considered more specific for purposes of method combination over dispatch value
`y`, e.g. because `x` derives from `y`, or because `x` (or one of its ancestors) has been explicitly preferred over
`y` (or one of its ancestors).

4-arity version does not take the `default-dispatch-value` into account, but 5-arity version does.
sourceraw docstring

domination-comparitorclj

(domination-comparitor dominates?-pred)
(domination-comparitor hierarchy prefs)
(domination-comparitor hierarchy prefs dispatch-value)

Given a hierarchy and prefs return a function that can be used to sort dispatch values from most-specific to least-specific.

Given a `hierarchy` and `prefs` return a function that can be used to sort dispatch values from most-specific to
least-specific.
sourceraw docstring

prefers?clj

(prefers? hierarchy prefs x y)

True if x or one of its ancestors is prefered over y or one of its ancestors.

True if `x` or one of its ancestors is prefered over `y` or one of its ancestors.
sourceraw docstring

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

× close