[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [KAHLE@Aquinas.Think.COM: defstruct request for common lisp]
- To: barmar@Think.COM
- Subject: Re: [KAHLE@Aquinas.Think.COM: defstruct request for common lisp]
- From: ghenis.pasa@Xerox.COM
- Date: Fri, 02 Oct 1987 14:20:00 -0000
- Cc: ghenis.pasa@Xerox.COM, common-lisp@sail.stanford.edu
- In-reply-to: Barry Margolin <barmar@Think.COM>'s message of Thu, 1 Oct 87 23:16 EDT
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