| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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 |
|
#2
| |||
| |||
| 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/ |
|
#3
| |||
| |||
| 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/ |
|
#4
| |||
| |||
| 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 ora rint-object option is supplied, and if no printer-name issupplied, 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. |
|
#5
| |||
| |||
| Thanks everyone for the info- I still have some work to do to become comfortable with the spec! -Conrad |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.