On this page:
make-multimethod
multimethod?
multimehtod-make-signature
multimethod-default-signature
set-method
remove-method
prefer-method
unprefer-method
exn: fail: multimethod
find-method
Version: 4.1.3.9

2.1 Procedural Protocol

(make-multimethod make-signature    
  [#:default default-signature    
  #:hierarchy ref-hierarchy])  multimethod?
  make-signature : procedure?
  default-signature : any/c = #f
  ref-hierarchy : (-> hierarchy?) = global-hierarchy

Creates a new multimethod. make-signature is the signature generator procedure applied every time the multimethod is called. default-signature is a default signature that is looked up in the method tables if the generated one doesn’t match any implementation. ref-hierarchy is a procedure yielding the value hierarchy to be used by signature comparisons for the new multimethod. ref-hierarchy defaults to global-hierarchy, ie. the default behaviour is to read the current value of the global hierarchy parameter every time the hierarchy is needed.

(multimethod? v)  boolean?
  v : any/c

Checks whether the given object is a multimethod.

(multimehtod-make-signature m)  procedure?
  m : multimethod?

Retrieves the signature generator of a multimethod.

(multimethod-default-signature m)  any/c
  m : multimethod?

Retrieves the default signature of a multimethod.

(set-method m signature method)  multimethod?
  m : multimethod?
  signature : any/c
  method : procedure?

Takes the multimethod m and transforms it into a new multimethod that maps the given signature to the method implementation method.

Any existing mapping for the given signature is replaced.

(remove-method m signature)  multimethod?
  m : multimethod?
  signature : any/c

Takes the multimethod m and transforms it into a new multimethod that has no direct mapping for the given signature to any method implementation.

(prefer-method m signature-a signature-b)  multimethod?
  m : multimethod?
  signature-a : any/c
  signature-b : any/c

Takes the multimethod m and transforms it into a new multimethod that prefers dispatching via signature-a to dispatching via signature-b.

(unprefer-method m signature-a signature-b)  multimethod?
  m : multimethod?
  signature-a : any/c
  signature-b : any/c

Takes the multimethod m and transforms it into a new multimethod that does not prefer dispatching via signature-a to dispatching via signature-b.

(struct (exn:fail:multimethod exn:fail) (multimethod signature))
  multimethod : multimethod?
  signature : any/c

An exception raised to signal a problems with the given multimethod, specifically concerning the given signature.

(find-method m signature)  procedure?
  m : multimethod?
  signature : any/c

Retrieves the method implementation for multimethod m that matches the given signature best.

The method lookup works as follows: