[r6rs-discuss] Proposed features for small Scheme, part 4F: more symmetry
cowan at ccil.org
Thu Nov 5 14:55:17 EST 2009
Brian Harvey scripsit:
> Vectors are the implementation of sequences whose length you know in advance.
> Lists are the implementation of sequences that might grow or shrink,
Quite true. In addition, it used to be true that vectors had O(1) access
and lists O(N); now they both have O(N) access, but the constant factor
is hugely larger for lists.
> or whose length is just however much stuff READ returns.
The same is true of strings and vectors, though; READ works the same on all.
> So it really does make
> sense that vectors are made all at once, whereas lists are consed together.
That argument would be more convincing if we didn't already have the
variadic constructor LIST, exactly parallel to STRING and VECTOR.
> You are flying in the face of decades of tradition here. This isn't an issue
> I would die on the barricades about, but I can't see why anyone would ever
> /use/ make-list.
I find myself often wanting it precisely when I am changing vectors to
lists. I start by using a vector in some application, then change it to
a list, then curse fate and type in the recursive definition of MAKE-LIST.
Still, if this is really idiosyncratic of me (does everyone else reach
for a list first, and have to be convinced that a vector is the Right
Thing?), I'll leave it out, I suppose.
I *am* having second thoughts about EMPTY-STRING? and EMPTY-VECTOR?,
though, precisely because we do recurse on lists but normally loop
through strings and vectors.
A rabbi whose congregation doesn't want John Cowan
to drive him out of town isn't a rabbi, http://www.ccil.org/~cowan
and a rabbi who lets them do it cowan at ccil.org
isn't a man. --Jewish saying
More information about the r6rs-discuss