[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [KAHLE@Aquinas.Think.COM: defstruct request for common lisp]
What limitation are you talking about? Structure slot names
are also the names of functions, which can be FUNCALLed. Thus, one
could write
(defun show-structure-slots (structure)
(dolist (slot (structure-slots (type-of structure)))
(format t "~A: ~S" slot (funcall slot structure))))
Mea culpa for reading too literally. I was (narrowly) thinking of the
semantics of STRUCTURE-SLOTS as returning slot NAMES, which would be of
very little use. Your interpretation could be better called
STRUCTURE-ACCESSORS and its output is truly useful. From that point of
view Kahle's request makes a lot more sense...
Pablo Ghenis