Node:Next-method, Next:Example, Previous:Generic functions and methods, Up:Generic functions
When a generic function is called, the list of applicable methods is
built. As mentioned before, the most specific method of this list is
applied (see Generic functions and methods). This method may call
the next method in the list of applicable methods. This is done by using
the special form next-method
. Consider the following definitions
(define-method (Test (a <integer>)) (cons 'integer (next-method))) (define-method (Test (a <number>)) (cons 'number (next-method))) (define-method (Test a) (list 'top))
With those definitions,
(Test 1) => (integer number top) (Test 1.0) => (number top) (Test #t) => (top)