Standard Methodical MultiFn impl.
Standard Methodical MultiFn impl.
(composite-effective-dispatch-value dispatcher
actual-dispatch-value
method-dispatch-values)
Combine multiple composite dispatch values into a single composite dispatch value that has the overall most-specific arg for each position, e.g.
;; String is more specific than Object; ::parrot is more specific than ::bird
(composite-effective-dispatch-value [[Object ::parrot] [String ::bird]]) ; -> [String ::parrot]
If the most-specific dispatch value is not composite, it returns it directly.
Combine multiple composite dispatch values into a single composite dispatch value that has the overall most-specific arg for each position, e.g. ```clj ;; String is more specific than Object; ::parrot is more specific than ::bird (composite-effective-dispatch-value [[Object ::parrot] [String ::bird]]) ; -> [String ::parrot] ``` If the most-specific dispatch value is not composite, it returns it directly.
(effective-dispatch-value dispatcher
actual-dispatch-value
primary-methods
aux-methods)
Given matching primary-methods
and aux-methods
for the actual-dispatch-value
, determine the effective dispatch
value.
Given matching `primary-methods` and `aux-methods` for the `actual-dispatch-value`, determine the effective dispatch value.
(non-composite-effective-dispatch-value dispatcher
actual-dispatch-value
method-dispatch-values)
Operates only on non-composite dispatch values. Determine the effective (most-specific) dispatch value that will be
used when dispatching on actual-dispatch-value
. If there is a dispatch value in method-dispatch-values
that
dominates all other method dispatch values, that is the effective dispatch value. Otherwise the actual dispatch
value will be used.
Example. Suppose a ::toucan
is a ::can
, and a ::toucan
is a ::bird
. If we dispatch off of ::toucan
and
only have a method for ::bird
, then ::bird
is the effective dispatch value, because there are no other dispatch
values that are more specific that would cause other methods to be used; the result is the same as if we had
dispatched off of ::bird
in the first place. However, if we add a ::can
method, the effective dispatch value for
::toucan
can no longer be ::bird
, because a ::bird
is not necessarily a ::can
. Thus our effective dispatch
value would become ::toucan
, since out of the three possibilities only a ::toucan
is both a ::bird
and a
::can
.
Operates only on non-composite dispatch values. Determine the effective (most-specific) dispatch value that will be used when dispatching on `actual-dispatch-value`. If there is a dispatch value in `method-dispatch-values` that dominates all other method dispatch values, that is the effective dispatch value. Otherwise the actual dispatch value will be used. Example. Suppose a `::toucan` is a `::can`, and a `::toucan` is a `::bird`. If we dispatch off of `::toucan` and only have a method for `::bird`, then `::bird` is the effective dispatch value, because there are no other dispatch values that are more specific that would cause other methods to be used; the result is the same as if we had dispatched off of `::bird` in the first place. However, if we add a `::can` method, the effective dispatch value for `::toucan` can no longer be `::bird`, because a `::bird` is not necessarily a `::can`. Thus our effective dispatch value would become `::toucan`, since out of the three possibilities only a `::toucan` is both a `::bird` and a `::can`.
(sort-dispatch-values dispatcher dispatch-values)
Sort dispatch values in order from most-specific-overall to least-specific-overall.
Sort dispatch values in order from most-specific-overall to least-specific-overall.
(standard-effective-method method-combination
dispatcher
method-table
dispatch-value)
Build an effective method using the 'standard' technique, taking the dispatch-value-method pairs in the
method-table
, finiding applicable ones using dispatcher
, and combining them using method-combination
.
Build an effective method using the 'standard' technique, taking the dispatch-value-method pairs in the `method-table`, finiding applicable ones using `dispatcher`, and combining them using `method-combination`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close