Previous Next Contents

8. Quick reference

Square brackets ("[" and "]") indicate optional elements. A vertical bar ("|") indicates an alternative. Thing* means zero or more occurrence of thing, thing+ means one or more occurrence. "{" and "}" are used for grouping.

8.1 Defining a class

(DEFCLASS class-name (superclass-name*)
  (slot-description*))

8.2 Slot descriptions

(slot-name slot-option*)

:ACCESSOR

function-name

:INITFORM

expression

:INITARG

keyword-symbol

8.3 Making instances

(MAKE-INSTANCE class {initarg value}*)

8.4 Method definitions

(DEFMETHOD generic-function-name [qualifier] specialized-lambda-list form*) where

8.5 Some functions

(DESCRIBE instance)

(DESCRIBE class)

(FIND-CLASS class-name) -> class

As in:

<cl> (FIND-CLASS 'teacher)

#<STANDARD-CLASS TEACHER {90374C5}>

(CLASS-NAME class) -> symbol

As in:

<cl> (class-name (find-class 'teacher))

TEACHER

(CLASS-PRECEDENCE-LIST class) -> list of classes

[This is called (CLOS::CLASS-PRECEDENCE-LIST class) in CLISP.]

[This is called (PCL:CLASS-PRECEDENCE-LIST class) in CMUCL.]

As in (CMUCL):

* (pcl:class-precedence-list  (find-class 'teacher))

(#<Standard-Class TEACHER {902FF6D}> #<Standard-Class PERSON {9010ADD}>
 #<Standard-Class STANDARD-OBJECT {56753B5}>
 #<Slot-Class PCL::SLOT-OBJECT {567545D}> #<Built-In-Class INSTANCE {567BDDD}>
 #<Built-In-Class T {567B68D}>)

(CLASS-DIRECT-SUPERCLASSES class) -> list of classes

[This is called (CLOS::CLASS-DIRECT-SUPERCLASSES class) in CLISP.]

[This is called (PCL:CLASS-DIRECT-SUPERCLASSES class) in CMU.]

As in (CMUCL):

* (pcl:class-direct-superclasses (find-class 'teacher))

(#<Standard-Class PERSON {9010ADD}>)

(CLASS-DIRECT-SUBCLASSES class) -> list of classes

[This isn't available in CLISP.]

[This is called (PCL:CLASS-DIRECT-SUBCLASSES class) in CMU.]

As in:

* (pcl:class-direct-subclasses (find-class 'teacher))

(#<Standard-Class MATHS-TEACHER {9040E9D}>)


Previous Next Contents