From: Conrad
Subject: CL reader and structures...
Date: 
Message-ID: <e5a4e5bd-85ff-4ee4-8967-24724045bb90@a1g2000hsb.googlegroups.com>
Hi everyone- I've been trying to figure out if the #S reader macro for
reading in structures is part of the Common Lisp standard...

For instance, the following code works for me in both CLISP and SBCL
(assuming the structure "person" is defined first)

> (person-age #S(PERSON :NAME "Bob" :AGE 35 :WAIST-SIZE 32 :FAVORITE-COLOR "blue"))
35


I can't find any reference to this in the standard- Anyone know
whether this is an official feature of CL?

Thanks in advance

-Conrad Barski

From: Conrad
Subject: Re: CL reader and structures...
Date: 
Message-ID: <3c7392b5-57fa-4290-8cc1-6df0616f1284@x41g2000hsb.googlegroups.com>
Thanks everyone for the info- I still have some work to do to become
comfortable with the spec!

-Conrad
From: Pascal Costanza
Subject: Re: CL reader and structures...
Date: 
Message-ID: <6hdqlkFl13o5U1@mid.individual.net>
Conrad wrote:
> Hi everyone- I've been trying to figure out if the #S reader macro for
> reading in structures is part of the Common Lisp standard...
> 
> For instance, the following code works for me in both CLISP and SBCL
> (assuming the structure "person" is defined first)
> 
>> (person-age #S(PERSON :NAME "Bob" :AGE 35 :WAIST-SIZE 32 :FAVORITE-COLOR "blue"))
> 35
> 
> 
> I can't find any reference to this in the standard- Anyone know
> whether this is an official feature of CL?

Yes, it is. The best place to look up whether something is part of the 
standard syntax is in Chapter 2 of the HyperSpec. See Section 2.4.8.13 
in this particular case.


Pascal

-- 
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Rainer Joswig
Subject: Re: CL reader and structures...
Date: 
Message-ID: <joswig-3D25BB.21394424082008@news-europe.giganews.com>
In article 
<····································@a1g2000hsb.googlegroups.com>,
 Conrad <······@gmail.com> wrote:

> Hi everyone- I've been trying to figure out if the #S reader macro for
> reading in structures is part of the Common Lisp standard...
> 
> For instance, the following code works for me in both CLISP and SBCL
> (assuming the structure "person" is defined first)
> 
> > (person-age #S(PERSON :NAME "Bob" :AGE 35 :WAIST-SIZE 32 :FAVORITE-COLOR "blue"))
> 35
> 
> 
> I can't find any reference to this in the standard- Anyone know
> whether this is an official feature of CL?
> 
> Thanks in advance
> 
> -Conrad Barski

Yes, that's in ANSI CL.

http://www.lispworks.com/documentation/HyperSpec/Body/02_dhm.htm

-- 
http://lispm.dyndns.org/
From: Pascal J. Bourguignon
Subject: Re: CL reader and structures...
Date: 
Message-ID: <87bpziurql.fsf@hubble.informatimago.com>
Conrad <······@gmail.com> writes:

> Hi everyone- I've been trying to figure out if the #S reader macro for
> reading in structures is part of the Common Lisp standard...
>
> For instance, the following code works for me in both CLISP and SBCL
> (assuming the structure "person" is defined first)
>
>> (person-age #S(PERSON :NAME "Bob" :AGE 35 :WAIST-SIZE 32 :FAVORITE-COLOR "blue"))
> 35
>
>
> I can't find any reference to this in the standard- Anyone know
> whether this is an official feature of CL?

Yes, for structure it is standard.


Guess the CLHS page!


    If no :type option is supplied, and if either a :print-function or
    a :print-object option is supplied, and if no printer-name is
    supplied, then a print-object method specialized for
    structure-name is generated that calls a function that implements
    the default printing behavior for structures using #S notation;
    see Section 22.1.3.12 (Printing Structures).



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NEW GRAND UNIFIED THEORY DISCLAIMER: The manufacturer may
technically be entitled to claim that this product is
ten-dimensional. However, the consumer is reminded that this
confers no legal rights above and beyond those applicable to
three-dimensional objects, since the seven new dimensions are
"rolled up" into such a small "area" that they cannot be
detected.