Liking cljdoc? Tell your friends :D

methodical.core

Combined interface to everything in Methodical you'd normally want to use.

Combined interface to everything in Methodical you'd normally want to use.
raw docstring

methodical.impl.cache.simple

A basic, dumb cache. SimpleCache stores cached methods in a simple map of dispatch-value -> effective method; it offers no facilities to deduplicate identical methods for the same dispatch value. This behaves similarly to the caching mechanism in vanilla Clojure.

A basic, dumb cache. `SimpleCache` stores cached methods in a simple map of dispatch-value -> effective method; it
offers no facilities to deduplicate identical methods for the same dispatch value. This behaves similarly to the
caching mechanism in vanilla Clojure.
raw docstring

No vars found in this namespace.

methodical.impl.cache.watching

A Cache implementation that wraps any other cache, watching one or more references (such as an atom or var), calling clear-cache! whenever one of those references changes.

WatchingCaches can be created by calling add-watches on another cache. add-watches is composable, meaning you can thread multiple calls to it to build a cache that watches the entire world go by. You could, for example, use this to build a multifn that supports a dynamic set of hierarchies, letting you add more as you go. The world's your oyster!

WatchingCaches' watch functions weakly reference their caches, meaning they do not prevent garbage collection of potentially large method maps; they also automatically clear out their watches when they are garbage collected and finalized (which, of course, may actually be never -- but worst-case is that some unneeded calls to clear-cache! get made).

A `Cache` implementation that wraps any other cache, watching one or more references (such as an
atom or var), calling `clear-cache!` whenever one of those references changes.

WatchingCaches can be created by calling `add-watches` on another cache. `add-watches` is composable, meaning you
can thread multiple calls to it to build a cache that watches the entire world go by. You could, for example, use
this to build a multifn that supports a dynamic set of hierarchies, letting you add more as you go. The world's your
oyster!

WatchingCaches' watch functions weakly reference their caches, meaning they do not prevent garbage collection of
potentially large method maps; they also automatically clear out their watches when they are garbage collected and
finalized (which, of course, may actually be never -- but worst-case is that some unneeded calls to `clear-cache!`
get made).
raw docstring

methodical.impl.combo.clojure

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

No vars found in this namespace.

methodical.impl.combo.clos

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

No vars found in this namespace.

methodical.impl.combo.common

Utility functions for implementing method combinations.

Utility functions for implementing method combinations.
raw docstring

methodical.impl.combo.operator

Method combinations strategies based on the non-default method combination types in CLOS. All non-default method combinations follow the same basic pattern:

(operator (primary-method-1 args) (primary-method-2 args) (primary-method-3 args)))

(Example from "Object-Oriented Programming in Common Lisp", Keene 1988.)

The non-default method combinations each support primary methods and :around methods, but not :before or :after. Unlike the standard combination, primary methods do not support call-next-method (next-method in Methodical).

There are 9 built-in method combinations types in CLOS, excluding standard: progn, append, list, nconc, and, or, max, min, and +. These are mostly the same in the implementation below, with the following exceptions:

  • The progn combo is instead named do, which you probably could have guessed.

  • list has been replaced by seq, which returns a lazy sequence -- a very Clojurey improvement.

  • Both nconc and append concatenate lists, but nconc does it destructively; append copies all arguments except the last. The Clojure equivalent of either is concat which is what I have named the method combination below. We actually do one better than CLOS and return a lazy sequence, but lazy-cat seemed like a cumbersome name for the combo.

One last difference: unlike CLOS operator method combinations, primary method implementations are not qualfied by their operator.

;; CLOS (defmethod total-electric-supply + ((city city)) ...)

;; Methodical (defmethod total-electric-supply :city [city] ...)

Method combinations strategies based on the non-default method combination types in CLOS. All non-default method
combinations follow the same basic pattern:

  (operator (primary-method-1 args)
            (primary-method-2 args)
            (primary-method-3 args)))

(Example from "Object-Oriented Programming in Common Lisp", Keene 1988.)

The non-default method combinations each support primary methods and `:around` methods, but not `:before` or
`:after`. Unlike the standard combination, primary methods do not support `call-next-method` (`next-method` in
Methodical).

There are 9 built-in method combinations types in CLOS, excluding `standard`: `progn`, `append`, `list`, `nconc`,
`and`, `or`, `max`, `min`, and `+`. These are mostly the same in the implementation below, with the following
exceptions:

* The `progn` combo is instead named `do`, which you probably could have guessed.

* `list` has been replaced by `seq`, which returns a lazy sequence -- a very Clojurey improvement.

* Both `nconc` and `append` concatenate lists, but `nconc` does it destructively; `append` copies all arguments
  except the last. The Clojure equivalent of either is `concat` which is what I have named the method combination
  below. We actually do one better than CLOS and return a lazy sequence, but `lazy-cat` seemed like a cumbersome name
  for the combo.

One last difference: unlike CLOS operator method combinations, primary method implementations *are not* qualfied by
their operator.

  ;; CLOS
  (defmethod total-electric-supply + ((city city))
    ...)

  ;; Methodical
  (defmethod total-electric-supply :city
    [city]
    ...)
raw docstring

methodical.impl.dispatcher.common

Utility functions for implementing Dispatchers.

Utility functions for implementing Dispatchers.
raw docstring

methodical.impl.dispatcher.everything

No vars found in this namespace.

methodical.impl.dispatcher.standard

A single-hierarchy dispatcher that behaves similarly to the way multimethod dispatch is done by vanilla Clojure multimethods, but with added support for auxiliary methods.

A single-hierarchy dispatcher that behaves similarly to the way multimethod dispatch is done by vanilla Clojure
multimethods, but with added support for auxiliary methods.
raw docstring

methodical.impl.method-table.clojure

No vars found in this namespace.

methodical.impl.method-table.standard

No vars found in this namespace.

methodical.impl.multifn.cached

No vars found in this namespace.

methodical.impl.multifn.standard

Standard Methodical MultiFn impl, which

Standard Methodical MultiFn impl, which 
raw docstring

methodical.macros

Methodical versions of vanilla Clojure defmulti and defmethod macros.

Methodical versions of vanilla Clojure `defmulti` and `defmethod` macros.
raw docstring

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

× close