[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regularization of Procedures in Scheme
Some notes and responses to Morry's proposal.
- APPEND! is not in R3RS; it was removed after R2RS.
- I'm not sure that I can imagine a reasonable use for STRING.
- Is there some reason why we are trying to keep strings and vectors
separate? I guess that it makes sense since "foo" would answer #t to
VECTOR? but VECTOR-SET! could not be used to stuff any old Scheme value
into it. Sigh. It just seems a bit of a pity. Perhaps we could make some
(most) of the string/vector operations polymorphic? That is, strings would
answer #f to VECTOR? but the same procedure could be used to reference
elements of both strings and vectors. Hmmm. Comments?
- I guess that I can see why an implementation could make a faster version
of SUBVECTOR that could be written in Scheme (by using a block-transfer
instruction), but I don't see that argument for SUBLIST. Can someone point
out to me the obviously-faster implementation I'm not seeing?
- The name ``=?'' in Morry's noncontroversial #6 should be ``equal?''.
- Controversial#1: Cedar Scheme has a predicate ``proper-list?'' that does
what Morry's ``list?'' would do. It's there because I've found it useful
at times, for example in the parsing of lambda-lists.
- Controversial #2: I don't see why the existence of the second form of
APPLY has any bearing on the question of whether or not vectors and strings
can be passed as the final argument.
- Controversial #3: For option (c), I think it's probably too expensive to
have to make a first pass down a list passed as an argument in order to
know how big a string/vector to allocate for the result. Maybe I'm just a
worry-wart, though. Option (c) is certainly more flexible. On the other
hand, these can be easily written in Scheme (I think as efficiently as in
some lower-level language), so I don't perceive a burning need for them.
- Controversials #4, 5, and 6: Since I don't think that EQUAL? is a
particularly natural predicate to have in the language (that is, it doesn't
seem as natural a predicate as EQ? and EQV?, it's just an arbitrary choice
out of the space of equivalence relations that happens to find some use),
I've never felt that MEMBER and ASSOC were particularly worthy of special
treatment. I would perhaps prefer that these names be used for more
general operations that took an equivalence predicate as an argument. This
aside, though, I agree with Morry that no extension is desirable here. As
for #6, I don't understand why Morry says that ``For match, this
polymorphism would extend to 2 levels into the data structure'' since MATCH
doesn't seem to care about a second level. More useful than MEMBER? and
MATCH might be the Common Lisp sequence functions POSITION and FIND which
take a value, a predicate, and a sequence and return, respectively, the
index and the value of the first element of the sequence on which (pred
value element) returns true. The function POSITION can be used as a
predicate, just like MEMBER?. Again, though, as in #3, I don't see why
these functions should be in the report at all, since they're so easy to
write. Put them in the yellow pages...
Pavel