[plt-scheme] Syntax question (improper lists)

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Mon Jan 30 17:09:45 EST 2006


On Mon, 30 Jan 2006, Greg Woodhouse wrote:

> Anyway, I'm thinking that
>
> a) I really do need to treat '() specially and not as a list.

Hi Greg,

Yeah; it's something of an edge case; according to:

http://download.plt-scheme.org/doc/301/html/r5rs/r5rs-Z-H-6.html#%_idx_64

they make a point to say that the empty list is treated as special.



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



> Having said that, I don't think I quite understand the rules here.

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


Best of wishes!



Posted on the users mailing list.