Many common Lisp implementations support the CLOS meta-object protocol. This provides introspective operations for classes, slots, and other meta objects.
In LispWorks, the corresponding functions are available directly in the CL-USER package.
CL-USER 139 > (defclass shape () ((color :initform :black) (thickness :initform 1) (filledp :initform nil) (window :initform nil)))
The slot-definition-name and class-direct-slots functions are defined by the CLOS meta-object protocol and are supported in many Common Lisp implementations - only the package in which they are located may differ. For example, in SBCL they can be found in the SB-MOP package.
From the class we can get a list of direct slots. Forward slots are slots that are directly defined for this class and which are not inherited. If you want to get a list of all slots, use the class-slots function.
The slot here means that we get a slot definition object that describes the slot. To get the name of the slot, you must get the name from the slot definition object using the slot-definition-name function.
source share