Liking cljdoc? Tell your friends :D

methodical.impl

Convenience constructors for various implementations of the different component parts of a Methodical multifn.

Convenience constructors for various implementations of the different component parts of a Methodical multifn.
raw docstring

+-method-combinationclj

(+-method-combination)

Executes all applicable primary methods, returnings the sum of the values returned by each method. Same constraints as othe CLOS operator-style method combinations.

Executes *all* applicable primary methods, returnings the sum of the values returned by each method. Same constraints
as othe CLOS operator-style method combinations.
raw docstring

and-method-combinationclj

(and-method-combination)

Invoke all applicable primary methods, from most-specific to least-specific; reducing the results as if by and. Like and, this method invocation short-circuits if any implementation returns a falsey value. Otherwise, this method returns the value returned by the last method invoked.

Invoke *all* applicable primary methods, from most-specific to least-specific; reducing the results as if by `and`.
Like `and`, this method invocation short-circuits if any implementation returns a falsey value. Otherwise, this
method returns the value returned by the last method invoked.
raw docstring

cached-multifn-implclj

(cached-multifn-impl impl)
(cached-multifn-impl impl cache)

Wrap a MultiFnImpl in a CachedMultiFnImpl, which adds caching to calculated effective methods. The cache itself is swappable with other caches that implement different strategies.

Wrap a `MultiFnImpl` in a `CachedMultiFnImpl`, which adds caching to calculated effective methods. The cache itself
is swappable with other caches that implement different strategies.
raw docstring

clojure-method-combinationclj

(clojure-method-combination)

Simple method combination strategy that mimics the way vanilla Clojure multimethods combine methods; that is, to say, not at all. Like vanilla Clojure multimethods, this method combination only supports primary methods.

Simple method combination strategy that mimics the way vanilla Clojure multimethods combine methods; that is, to say,
not at all. Like vanilla Clojure multimethods, this method combination only supports primary methods.
raw docstring

clojure-method-tableclj

(clojure-method-table)
(clojure-method-table m)

Create a new Clojure-style method table. Clojure-style method tables only support primary methods.

Create a new Clojure-style method table. Clojure-style method tables only support primary methods.
raw docstring

clojure-multifn-implclj

(clojure-multifn-impl dispatch-fn
                      &
                      {:keys [hierarchy default-value prefers method-table]})

Create a mulitfn impl that largely behaves the same way as a vanilla Clojure multimethod.

Create a mulitfn impl that largely behaves the same way as a vanilla Clojure multimethod.
raw docstring

clos-method-combinationclj

(clos-method-combination)

Method combination stategy that mimics the standard method combination in the Common Lisp Object System (CLOS). Supports :before, :after, and :around auxiliary methods. The values returned by :before and :after methods are ignored. Primary methods and around methods get an implicit next-method arg (see Methodical dox for more on what this means).

Method combination stategy that mimics the standard method combination in the Common Lisp Object System (CLOS).
Supports `:before`, `:after`, and `:around` auxiliary methods. The values returned by `:before` and `:after` methods
are ignored. Primary methods and around methods get an implicit `next-method` arg (see Methodical dox for more on
what this means).
raw docstring

clos-multifn-implclj

(clos-multifn-impl dispatch-fn
                   &
                   {:keys [hierarchy default-value prefers primary-method-table
                           aux-method-table]})

Convenience for creating a new multifn instances that for the most part mimics the behavior of CLOS generic functions using the standard method combination. Supports :before, :after, and :around auxiliary methods, but values of :before and :after methods are ignored, rather than threaded. Primary and :around methods each get an implicit next-method arg.

Convenience for creating a new multifn instances that for the most part mimics the behavior of CLOS generic functions
using the standard method combination. Supports `:before`, `:after`, and `:around` auxiliary methods, but values of
`:before` and `:after` methods are ignored, rather than threaded. Primary and `:around` methods each get an implicit
`next-method` arg.
raw docstring

concat-method-combinationclj

(concat-method-combination)

Like the seq-method-combination, but concatenates all the results together.

seq-method-combination : map :: concat-method-combination : mapcat

Like the `seq-method-combination`, but concatenates all the results together.

seq-method-combination : map :: concat-method-combination : mapcat
raw docstring

default-multifnclj

(default-multifn dispatch-fn & {:keys [hierarchy default-value prefers]})

Create a new Methodical multifn using the default impl.

Create a new Methodical multifn using the default impl.
raw docstring

default-multifn-implclj

(default-multifn-impl dispatch-fn & {:keys [hierarchy default-value prefers]})

Create a basic multifn impl using default choices for method combination, dispatcher, and method table.

Create a basic multifn impl using default choices for method combination, dispatcher, and method table.
raw docstring

do-method-combinationclj

(do-method-combination)

Based on the CLOS progn method combination. Sequentially executes all applicable primary methods, presumably for side-effects, in order from most-specific to least-specific; returns the value returned by the least-specific method. do method combinations support :around auxiliary methods, but not :before or :after methods.

Based on the CLOS `progn` method combination. Sequentially executes *all* applicable primary methods, presumably for
side-effects, in order from most-specific to least-specific; returns the value returned by the least-specific
method. `do` method combinations support `:around` auxiliary methods, but not `:before` or `:after` methods.
raw docstring

everything-dispatcherclj

(everything-dispatcher &
                       {:keys [hierarchy prefers]
                        :or {hierarchy (var clojure.core/global-hierarchy)
                             prefers {}}})

A Dispatcher that always considers all primary and auxiliary methods to be matches; does not calculate dispatch values for arguments when invoking. Dispatch values are still used to sort methods from most- to least- specific, using hierarchy and map of prefers.

A Dispatcher that always considers *all* primary and auxiliary methods to be matches; does not calculate dispatch
values for arguments when invoking. Dispatch values are still used to sort methods from most- to least- specific,
using `hierarchy` and map of `prefers`.
raw docstring

max-method-combinationclj

(max-method-combination)

Executes all applicable primary methods, and returns the maximum value returned by any one implemenation. Same constraints as othe CLOS operator-style method combinations.

Executes *all* applicable primary methods, and returns the maximum value returned by any one implemenation. Same
constraints as othe CLOS operator-style method combinations.
raw docstring

min-method-combinationclj

(min-method-combination)

Based on the CLOS method combination of the same name. Executes all applicable primary methods, returning the minimum value returned by any implementation. Like do method combinations, min supports :around auxiliary methods, but not :before or :after.

Based on the CLOS method combination of the same name. Executes *all* applicable primary methods, returning the
minimum value returned by any implementation. Like `do` method combinations, `min` supports `:around` auxiliary
methods, but not `:before` or `:after`.
raw docstring

multi-default-dispatcherclj

(multi-default-dispatcher dispatch-fn
                          &
                          {:keys [hierarchy default-value prefers]
                           :or {hierarchy (var clojure.core/global-hierarchy)
                                default-value :default
                                prefers {}}})

Like the standard dispatcher, with one big improvement: when dispatching on multiple values, it supports default methods that specialize on some args and use the default for others. (e.g. [String :default])

Like the standard dispatcher, with one big improvement: when dispatching on multiple values, it supports default
methods that specialize on some args and use the default for others. (e.g. `[String :default]`)
raw docstring

multifnclj

(multifn impl)
(multifn impl mta)
(multifn impl mta cache)

Create a new cached Methodical multifn using impl as the multifn implementation.

Create a new *cached* Methodical multifn using `impl` as the multifn implementation.
raw docstring

or-method-combinationclj

(or-method-combination)

Like the and combination, but combines result as if by or; short-circuits after the first matching primary method returns a truthy value.

Like the `and` combination, but combines result as if by `or`; short-circuits after the first matching primary method
returns a truthy value.
raw docstring

seq-method-combinationclj

(seq-method-combination)

Executes all applicable primary methods, from most-specific to least-specific; returns a sequence of results from the method invocations. Inspired by CLOS nconc and append method combinations, but unlike those, this combination returns a completely lazy sequence. Like other CLOS-operator-inspired method combinations, this combination currently supports :around methods, but not :before or :after methods.

Executes *all* applicable primary methods, from most-specific to least-specific; returns a sequence of results from
the method invocations. Inspired by CLOS `nconc` and `append` method combinations, but unlike those, this
combination returns a completely lazy sequence. Like other CLOS-operator-inspired method combinations, this
combination currently supports `:around` methods, but not `:before` or `:after` methods.
raw docstring

simple-cacheclj

(simple-cache)
(simple-cache m)

Create a basic dumb cache. The simple cache stores

Create a basic dumb cache. The simple cache stores
raw docstring

standard-dispatcherclj

(standard-dispatcher dispatch-fn
                     &
                     {:keys [hierarchy default-value prefers]
                      :or {hierarchy (var clojure.core/global-hierarchy)
                           default-value :default
                           prefers {}}})

Create a stanadrd Methodical multifn dispatcher. The standard dispatcher replicates the way vanilla Clojure multimethods handle multimethod dispatch, with support for a custom hierarchy, default-value and map of prefers.

Create a stanadrd Methodical multifn dispatcher. The standard dispatcher replicates the way vanilla Clojure
multimethods handle multimethod dispatch, with support for a custom `hierarchy`, `default-value` and map of
`prefers`.
raw docstring

standard-method-tableclj

(standard-method-table)
(standard-method-table primary aux)

Create a new standard method table that supports both primary and auxiliary methods.

Create a new standard method table that supports both primary and auxiliary methods.
raw docstring

standard-multifn-implclj

(standard-multifn-impl combo dispatcher method-table)

Create a basic multifn impl using method combination combo, dispatcher dispatcher, and method-table.

Create a basic multifn impl using method combination `combo`, dispatcher `dispatcher`, and `method-table`.
raw docstring

thread-first-method-combinationclj

(thread-first-method-combination)

Similar the the standard CLOS-style method combination, but threads the result of each :before and :after auxiliary methods, as well as the primary method, as the first arg of subsequent method invocations.

Similar the the standard CLOS-style method combination, but threads the result of each `:before` and `:after`
auxiliary methods, as well as the primary method, as the *first* arg of subsequent method invocations.
raw docstring

thread-last-method-combinationclj

(thread-last-method-combination)

Similar the the standard CLOS-style method combination, but threads the result of each :before and :after auxiliary methods, as well as the primary method, as the last arg of subsequent method invocations.

Similar the the standard CLOS-style method combination, but threads the result of each `:before` and `:after`
auxiliary methods, as well as the primary method, as the *last* arg of subsequent method invocations.
raw docstring

uncached-multifnclj

(uncached-multifn impl)
(uncached-multifn impl mta)

Create a new Methodical multifn using impl as the multifn implementation; impl itself should implement MultiFnImpl. DOES NOT CACHE EFFECTIVE METHODS -- use multifn instead, unless you like slow dispatch times.

Create a new Methodical multifn using `impl` as the multifn implementation; `impl` itself should implement
`MultiFnImpl`. DOES NOT CACHE EFFECTIVE METHODS -- use `multifn` instead, unless you like slow dispatch times.
raw docstring

watching-cacheclj

(watching-cache cache references)

Wrap cache in a WatchingCache, which clears the cache whenever one of the watched references (such as vars or atoms) changes. Intended primarily for use with 'permanent' MultiFns, such as those created with defmulti; this is rarely needed or wanted for transient multifns.

Wrap `cache` in a `WatchingCache`, which clears the cache whenever one of the watched `references` (such as vars or
atoms) changes. Intended primarily for use with 'permanent' MultiFns, such as those created with `defmulti`; this is
rarely needed or wanted for transient multifns.
raw docstring

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

× close