[r6rs-discuss] Proposed features for small Scheme, part 4F: more symmetry
bh at cs.berkeley.edu
Wed Nov 4 23:31:27 EST 2009
> Make-list has the same arguments as make-string and make-vector: an
> element count and an optional fill.
Why do we bother having both lists and vectors in Scheme? I think it's
because they behave differently and encourage different programming styles.
Vectors are the implementation of sequences whose length you know in advance.
Lists are the implementation of sequences that might grow or shrink, or
whose length is just however much stuff READ returns. So it really does make
sense that vectors are made all at once, whereas lists are consed together.
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'm all for orthogonality in its place; I grew up on a
computer with all sixteen possible Boolean operators, including the no-ops.
But, speaking as a teacher, I think this particular attempt at orthogonality
would just obscure how and why lists and vectors differ.
PS: Yes, in some ways it'd be better if lists were a purely abstract data
type, so we'd (define first car), (define rest cdr), (define adjoin cons).
But unless you want Scheme to print lists as (1 . (2 . (3 . ()))), you're
already committed to Scheme knowing about the tight connection between
lists and pairs.
More information about the r6rs-discuss