CL reader and structures...

This is a discussion on CL reader and structures... within the lisp forums in Programming Languages category; 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...

Go Back   Application Development Forum > Programming Languages > lisp

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-24-2008, 03:18 PM
Conrad
Guest
 
Default CL reader and structures...

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

Reply With Quote
  #2  
Old 08-24-2008, 03:21 PM
Pascal Costanza
Guest
 
Default Re: CL reader and structures...

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/
Reply With Quote
  #3  
Old 08-24-2008, 03:39 PM
Rainer Joswig
Guest
 
Default Re: CL reader and structures...

In article
<e5a4e5bd-85ff-4ee4-8967-24724045bb90@a1g2000hsb.googlegroups.com>,
Conrad <drcode@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/documentati...ody/02_dhm.htm

--
http://lispm.dyndns.org/
Reply With Quote
  #4  
Old 08-24-2008, 03:40 PM
Pascal J. Bourguignon
Guest
 
Default Re: CL reader and structures...

Conrad <drcode@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 rint-function or
a rint-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.
Reply With Quote
  #5  
Old 08-24-2008, 06:05 PM
Conrad
Guest
 
Default Re: CL reader and structures...

Thanks everyone for the info- I still have some work to do to become
comfortable with the spec!

-Conrad
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 02:17 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.