Slot Values

; Get the stored value of a slot
(defun slot-value (object slot-name)
  (get object slot-name))

; Set the stored value of a slot
(defun set-slot-value (object slot-name value)
  (setf (get object slot-name) value) )

; Tell Lisp how to store a slot value,
; e.g. (setf (slot-value obj slot) val)

(defsetf slot-value set-slot-value)

; get the names of all slots defined for a class
(defun slot-names (class)
  (let (names)
    (setq names (mapcar #'car
                        (get class 'slots)))
    (dolist (super (get class 'supers))
      (setq names (union names
                         (slot-names super))) )

Contents    Page-10    Prev    Next    Page+10    Index