Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Extracting class slot names

916 views
Skip to first unread message

Ron Garret

unread,
Dec 15, 2008, 6:10:11 PM12/15/08
to
Is there a portable way to get a list of the names of all the slots in a
class? I know about class-slots (and class-direct-slots) but these
return (apparently) opaque slot-definition objects from which the name
cannot be portably extracted.

Thanks,
rg

Marcus Breiing

unread,
Dec 15, 2008, 6:22:52 PM12/15/08
to
* Ron Garret

> I know about class-slots (and class-direct-slots) but these return
> (apparently) opaque slot-definition objects from which the name
> cannot be portably extracted.

Try to call SLOT-DEFINITION-NAME on these objects, which should be
about as (non-)portable as CLASS-SLOTS itself.

Rainer Joswig

unread,
Dec 15, 2008, 6:25:41 PM12/15/08
to
In article <rNOSPAMon-E37E7...@news.gha.chartermi.net>,
Ron Garret <rNOS...@flownet.com> wrote:

CL-USER 82 > (defclass foobaz () (a b))
#<STANDARD-CLASS FOOBAZ 402000850B>

CL-USER 83 > (class-direct-slots *)
(#<STANDARD-DIRECT-SLOT-DEFINITION A 412021FACB> #<STANDARD-DIRECT-SLOT-DEFINITION B 412021FAE3>)

CL-USER 84 > (slot-definition-name (first *))
A


I which packages the functions are is implementation
dependent. Also not every implementation
stores slot-information as slot-definition
objects.

--
http://lispm.dyndns.org/

Ron Garret

unread,
Dec 15, 2008, 6:44:14 PM12/15/08
to
In article <k0tvmt...@breiing.com>,
Marcus Breiing <use...@2008w49.mail.breiing.com> wrote:

Just what I was looking for. Thanks!

rg

Ron Garret

unread,
Dec 15, 2008, 6:44:50 PM12/15/08
to
In article <joswig-87C86B....@news-europe.giganews.com>,
Rainer Joswig <jos...@lisp.de> wrote:

Just what I needed. Thanks!

rg

Pascal Costanza

unread,
Dec 16, 2008, 12:32:04 AM12/16/08
to

(mapcar #'slot-definition-name (class-slots some-class))

--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/

Nicolas Edel

unread,
Dec 16, 2008, 5:22:48 AM12/16/08
to
On Dec 16, 12:25 am, Rainer Joswig <jos...@lisp.de> wrote:
> [...]
> CL-USER 83 > (class-direct-slots *)
>

Sorry for the clearly out of topic question, but any idea where I
could find documentation about this '*' variable ? Hard to google
about '*' or 'start' symbol !

-Nicolas

Rainer Joswig

unread,
Dec 16, 2008, 5:36:46 AM12/16/08
to
In article
<4c943efd-f5a8-46e3...@e25g2000vbe.googlegroups.com>,
Nicolas Edel <nicola...@gmail.com> wrote:

* is the last value
** the value before that
*** the value before that

See also -, + and /

HyperSpec, Symbol Index, Non-Alphabetic

http://www.lispworks.com/documentation/HyperSpec/Front/X_Alph_9.htm


Variable *, **, ***
http://www.lispworks.com/documentation/HyperSpec/Body/v__stst_.htm

When you use LispWorks, c-sh-d on a symbol shows the
documentation for the symbol in a web browser...

--
http://lispm.dyndns.org/

Zach Beane

unread,
Dec 16, 2008, 6:15:18 AM12/16/08
to
Nicolas Edel <nicola...@gmail.com> writes:

http://l1sp.org/cl/* will get you there (most other CL symbols work
too).

Zach

Rainer Joswig

unread,
Dec 16, 2008, 6:41:22 AM12/16/08
to
In article <m3vdtks...@unnamed.xach.com>,
Zach Beane <xa...@xach.com> wrote:

If all fails (no internet connection, no browser, ...) there is
still hope:

CL-USER 103 > (documentation '* 'variable)
"Holds the value of the most recent top-level EVAL."

CL-USER 104 > (documentation 'documentation 'function)
"Returns the documentation string associated with the given object (if any)."

--
http://lispm.dyndns.org/

Nicolas Edel

unread,
Dec 16, 2008, 8:00:34 AM12/16/08
to
On Dec 16, 12:41 pm, Rainer Joswig <jos...@lisp.de> wrote:
> In article <m3vdtks75l....@unnamed.xach.com>,
>  Zach Beane <x...@xach.com> wrote:

>
> > Nicolas Edel <nicolas.e...@gmail.com> writes:
>
> > > On Dec 16, 12:25 am, Rainer Joswig <jos...@lisp.de> wrote:
> > >> [...]
> > >> CL-USER 83 > (class-direct-slots *)
>
> > > Sorry for the clearly out of topic question, but any idea where I
> > > could find documentation about this '*' variable ? Hard to google
> > > about '*' or 'start' symbol !
>
> >http://l1sp.org/cl/*will get you there (most other CL symbols work

> > too).
>
> > Zach
>
> If all fails (no internet connection, no browser, ...) there is
> still hope:
>
> CL-USER 103 > (documentation '* 'variable)
> "Holds the value of the most recent top-level EVAL."
>
> CL-USER 104 > (documentation 'documentation 'function)
> "Returns the documentation string associated with the given object (if any)."
>
> --http://lispm.dyndns.org/

It has the meaning I felt it has but wasn't sure whether I was missing
something or not.
Thanks for the documentation howto ;)

-Nicolas

Nicolas Edel

unread,
Dec 16, 2008, 8:13:48 AM12/16/08
to
On Dec 16, 11:36 am, Rainer Joswig <jos...@lisp.de> wrote:
> In article
> <4c943efd-f5a8-46e3-b76f-a26df95a9...@e25g2000vbe.googlegroups.com>,

>  Nicolas Edel <nicolas.e...@gmail.com> wrote:
>
> > On Dec 16, 12:25 am, Rainer Joswig <jos...@lisp.de> wrote:
> > > [...]
> > > CL-USER 83 > (class-direct-slots *)
>
> > Sorry for the clearly out of topic question, but any idea where I
> > could find documentation about this '*' variable ? Hard to google
> > about '*' or 'start' symbol !
>
> > -Nicolas
>
> * is the last value
> ** the value before that
> *** the value before that
>
> See also  -, + and /
>
> HyperSpec, Symbol Index, Non-Alphabetic
>
> http://www.lispworks.com/documentation/HyperSpec/Front/X_Alph_9.htm
>
> Variable *, **, ***http://www.lispworks.com/documentation/HyperSpec/Body/v__stst_.htm

>
> When you use LispWorks, c-sh-d on a symbol shows the
> documentation for the symbol in a web browser...
>
> --http://lispm.dyndns.org/

Thanks, I just learned the +, ++ and +++ variables.

-Nicolas

Buaya Kamboja

unread,
Nov 15, 2023, 4:59:06 AM11/15/23
to
0 new messages