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.
No vars found in this namespace.
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).
No vars found in this namespace.
Utility functions for implementing method combinations.
Utility functions for implementing method combinations.
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] ...)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close