Next: , Previous: , Up: Introspection   [Contents][Index]


8.8.4 Generic Functions

A generic function is an instance of the <generic> class, or of a subclass of <generic>. The definition of the <generic> class has slots that are used to describe the properties of a generic function.

primitive procedure: generic-function-name gf

Return the name of generic function gf.

primitive procedure: generic-function-methods gf

Return a list of the methods of generic function gf. This is the value of gf’s methods slot.

Similarly, a method is an instance of the <method> class, or of a subclass of <method>; and the definition of the <method> class has slots that are used to describe the properties of a method.

primitive procedure: method-generic-function method

Return the generic function that method belongs to. This is the value of method’s generic-function slot.

primitive procedure: method-specializers method

Return a list of method’s formal parameter specializers . This is the value of method’s specializers slot.

primitive procedure: method-procedure method

Return the procedure that implements method. This is the value of method’s procedure slot.

generic: method-source
method: method-source (m <method>)

Return an expression that prints to show the definition of method m.

(define-generic cube)

(define-method (cube (n <number>))
  (* n n n))

(map method-source (generic-function-methods cube))
⇒
((method ((n <number>)) (* n n n)))