The classes <function>, <generic-function>, and <method>
<function> [Abstract Class]
<function> is the class of all objects that can be applied to arguments. It is the superclass of generic functions and methods. <function> inherits from <object>.
<generic-function> [Instantiable Class]
<generic-function> is the class of functions which contain methods. Generic functions inherit from <function>.The class <generic-function> supports the following init-keywords: required: number-or-sequence
This represents the required arguments that the generic function accepts. If a sequence is supplied, the size of the sequence is the number of required arguments, and the elements of the sequence are the specializers. If a number is supplied, it is the number of required arguments, and the specializers default to <object>. If the argument is not supplied, or the supplied argument is neither a sequence nor a non-negative integer, an error is signaled.
rest?: boolean
A true value indicates that the generic function accepts a variable number of arguments. The default is #f.
key: collection-of-keywords-or-#f .
If the value is a collection, then the generic function accepts keyword arguments, and the collection specifies the set of mandatory keywords for the generic function. A value of #f indicates that the generic function does not accept keyword arguments. The default is #f.
all-keys?: boolean
A true value indicates that the generic function accepts all keyword arguments. The default is #f.
An error is signaled if the value of rest?: is true and the value of key: is a collection.
An error is signaled if the value of all-keys?: is true and the value of key: is #f.
The new generic function initially has no methods. An error will be signaled if the generic function is called before methods are added to it. Once a generic function is created, you can give it behavior by adding methods to it with add- method or define method.
Generic functions are not usually created directly. Most often they are created by define generic or indirectly by define method.
<method> [Class]
Methods inherit from <function>.Next section: Introduction