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
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/
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/
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.