On this page:
define-multimethod
parameterize-multimethod
define-method
define-preference
Version: 4.1.4.1

3.2 Syntactic Sugar

(define-multimethod name+args :: signature
   options ...)
 
name+args = (name . args)
  | name

Expands to a define form assigning a multimethod to name.

If args are given, signature is implicitly wrapped in a lambda expression with args as arguments. Otherwise signature must evaluate to a procedure. In either case the resulting procedure becomes the signature generator of the new multimethod.

The options are passed on to make-multimethod and may be used to specify keyword arguments.

(parameterize-multimethod (name ...)
  expr ...)
 
  name : multimethod?

Extracts the parameter objects holding the current overloads from the multimethods given by name ... and parameterizes them to their current values for the dynamic extent of expr ....

This is useful to install methods or preferences temporarily.

(define-method name+args #:default method ...)
(define-method name+args :: signature method ...)
 
name+args = (name . args)
  | name
 
  name : multimethod?

Attaches a new method implementation to the multimethod name or removes an existing one, modifying the value of the parameter holding the current overloads.

The signature for the new method is either the default signature of the multimethod, if #:default is specified, or the given signature. signature is implicitly quasiquoted.

If args are given, the method body specified by method ... is implicitly wrapped in a lambda expression with args as arguments. Otherwise method must be a single expression evaluating to a procedure. In either case the resulting procedure becomes the method implementation.

If no args are given and method evaluates to #f, any existing implementation for the given signature is removed.

(define-preference name :: preference)
 
preference = (< signature-a signature-b)
  | (> signature-a signature-b)
  | (= signature-a signature-b)

Attaches a new preference to the multimethod name or removes an existing one, modifying the value of the parameter holding the current overloads.

The given signatures are implicitly quasiquoted.

The type of preference registered or unregistered depends on the form of preference: