From: Ethan Brown
Subject: Re: CLOS question
Date:
Message-ID: <918@esosun.UUCP>
In article <····@ucl-cs.uucp>, ·······@cs (Carl Evans) writes:
>
>Is there a built in function/method that
>returns a list of all the defined slots
>for an object of a given class ?
>
>Carl
Here's a quick one I wrote for Harliquin's lispworks:
(defun make-slot-list (object)
"Create a list of an object's slot names."
(let ((slots (clos::class-instance-slots (class-of object))))
(mapcar #'clos::slot-definition-name slots)
)
)
--
--Ethan Brown
--Science Applications International Corp.
--Geophysics Division (·····@esosun.css.gov)
--San Diego, CA 92121 (619) 458-2676
In article <····@ucl-cs.uucp> ·······@cs.ucl.ac.uk (Carl Evans) writes:
>Is there a built in function/method that
>returns a list of all the defined slots
>for an object of a given class ?
If your CLOS implementation supports the MOP as described in "The Art of
the Metaobject Protocol", you can do this with the CLASS-SLOTS generic
function.
--
Barry Margolin
System Manager, Thinking Machines Corp.
······@think.com {uunet,harvard}!think!barmar