[plt-scheme] Syntax question (improper lists)

From: Bill Wood (william.wood3 at comcast.net)
Date: Mon Jan 30 17:33:02 EST 2006

On Mon, 2006-01-30 at 14:09 -0800, Danny Yoo wrote:
   . . .
> > b) Using dotted pairs wasn't such a great idea, and I really ought to
> > use proper lists.
> 
> I'm not sure a choice in representation really matters.  As long as we
> abstract the tag and value selectors, it shouldn't make too much of a
> difference, unless I'm missing something here.

I'd second this.  I often use this technique as a sort of "canonical"
lisp representation of algebraic types ala Haskell or SML.  To be sure,
the details of the representation matter less than its self-consistency.
For most cases the fact that using cons rather than list results in one
less cons cell per form is of no practical importance.

   . . .
> MzScheme is a little looser than the r5rs doc, since the last paragraph
> in:
> 
> http://download.plt-scheme.org/doc/301/html/r5rs/r5rs-Z-H-7.html#%_sec_4.1.3
> 
> metions that () is not syntactically valid as an expression.  In contrast,
> the MzScheme reference manual extends things a bit and says that it's ok,
> and that it's magically transformed to '():
> 
> http://download.plt-scheme.org/doc/301/html/mzscheme/mzscheme-Z-H-2.html#node_sec_2.10

Maybe it's my Lisp background, but I've resisted the mzscheme looseness
here -- I always quote the empty list when I want the literal, and
seeing it unquoted makes me uneasy.

 -- Bill Wood




Posted on the users mailing list.