11 The Built-In Classes
<object>
<function>
. Functions are described in Chapter 6, "Functions."
<function>
<number>
or <sequence>
.
<boolean>
.
#f
or an instance of <collection>
whose elements are keywords.
<boolean>
.
The arguments describe the shape of the generic function's parameter list, and thereby control which methods can be added to the generic function. See the section "Kinds of Parameter Lists" on page 84 and the section "Parameter List Congruency" on page 91 for the implications of these choices.
An error is signaled if the value of rest?: is true and the value of key: is a collection. While a method parameter list may specify both #rest
and #key
, a generic function parameter list cannot.
An error is signaled if the value of all-keys?: is true and the value of key: is #f.
A new generic function initially has no methods. An error will be signaled if a 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 addmethod or define method.
Generic functions are not usually created by calling make
directly. Most often they are created by define generic or implicitly by define method.
Function | Description | Page | |
---|---|---|---|
generic-function- | Returns the methods of a generic function. | 338 | |
add-method | Adds a method to a generic function. | 338 | |
generic-function- | Returns the mandatory keywords of a generic function, if any. | 339 | |
sorted-applicable-methods | Returns all the methods in a generic function that are applicable to sample arguments, sorted in order of specificity. | 342 | |
find-method | Returns the method in a generic function that has particular specializers. | 343 | |
remove-method | Removes a method from a generic function. | 343 |
<function>
Function | Description | Page | |
---|---|---|---|
add-method | Adds a method to a generic function. | 338 | |
remove-method | Removes a method from a generic function. | 343 |
Generated with Harlequin WebMaker