From: ·············@gmail.com
Subject: Iterating over the slots in a class
Date: 
Message-ID: <1183477900.629003.72760@q75g2000hsh.googlegroups.com>
Hi,

Is there a simple way of iterating over all the slots of a class? I'd
prefer an implementation-agnostic way of doing this (i.e. something
that works in both sbcl, lispworks and openMCL).

I presume there should be some simple way of doing this using the MOP
but I don't know much about the MOP...

Thanks...

From: Geoffrey Summerhayes
Subject: Re: Iterating over the slots in a class
Date: 
Message-ID: <1183487346.424289.149460@c77g2000hse.googlegroups.com>
On Jul 3, 11:51 am, ·············@gmail.com wrote:
> Hi,
>
> Is there a simple way of iterating over all the slots of a class? I'd
> prefer an implementation-agnostic way of doing this (i.e. something
> that works in both sbcl, lispworks and openMCL).
>
> I presume there should be some simple way of doing this using the MOP
> but I don't know much about the MOP...
>
> Thanks...

Don't have SBCL or openMCL here, but APROPOS should
get you the appropriate package names for the MOP calls.

(mapcar #'slot-definition-name
        (class-effective-slots
         (class-of 'foo)))

---
Geoff
From: Dmitri Gorbatovsky
Subject: Re: Iterating over the slots in a class
Date: 
Message-ID: <f6eh2o$275m$1@sxnews1.qg.com>
 ·············@gmail.com wrote:

> Hi,
> 
> Is there a simple way of iterating over all the slots of a class? I'd
> prefer an implementation-agnostic way of doing this (i.e. something
> that works in both sbcl, lispworks and openMCL).
> 
> I presume there should be some simple way of doing this using the MOP
> but I don't know much about the MOP...
> 
> Thanks...
In sbcl you would find necessary functions in :sb-pcl package.

As a simple clue you may try :
 
(mapcar #'sb-pcl:slot-definition-name
          (sb-pcl:class-slots (find-class your-class-name)))

dg.