From: Mitch
Subject: List all slots in a class
Date: 
Message-ID: <v8ern3d3cbgqbmsgojvi2boj2h3i40m3ph@4ax.com>
Is there a way to obtain a list of all the slots in a class?

Mitch

From: Vassil Nikolov
Subject: Re: List all slots in a class
Date: 
Message-ID: <snwsl1e5gg0.fsf@luna.vassil.nikolov.names>
Mitch <········@bermita.com> writes:

> Is there a way to obtain a list of all the slots in a class?

  As with the MOP's CLASS-DIRECT-SLOTS and CLASS-SLOTS?
  <http://www.lisp.org/mop/dictionary.html>

  ---Vassil.

-- 
Bound variables, free programmers.
From: vanekl
Subject: Re: List all slots in a class
Date: 
Message-ID: <e97bf7fe-9276-4c23-9d56-2756ea38a9e9@21g2000hsj.googlegroups.com>
Pascal Bourguignon was kind enough to show me this:

> Personally, I would be most interested in seeing how to iterate through
> each slot without having to know the slot names a priori.

[211]> (asdf:oos 'asdf:load-op :closer-mop)
...
[212]> (defclass c1 () (a b))
#1=#<STANDARD-CLASS C1>
[213]> (defclass c2 (c1) (d e f))
#1=#<STANDARD-CLASS C2>
[214]> (closer-mop:compute-slots (find-class 'c2))
(#<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION A #x2052E666>
 #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION B #x2052E6A6>
 #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION D #x2052E6E6>
 #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION E #x2052E726>
 #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION F #x2052E766>)

[217]> (dolist (slot (closer-mop:compute-slots (find-class 'c2)))
         (print (closer-mop:slot-definition-name slot)))

A
B
D
E
F
NIL
From: Ken Tilton
Subject: Re: List all slots in a class
Date: 
Message-ID: <477e1af7$0$9159$607ed4bc@cv.net>
Mitch wrote:
> Is there a way to obtain a list of all the slots in a class?

Meta-help: (apropos "-SLOTS") or (apropos "CLASS"), where the string is 
a chance to apply your googleskill at guessing at subsequences that will 
reveal what you seek.

kt

-- 
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius