Hi,
R6RS banishes set-car! and set-cdr! to the wilderness.
In the case of set-cdr!, the reason is understandable: set-cdr! can
alter a list structure, and functions like map are more difficult to
write and potentially less efficient if the list structure of their
arguments can change during their call.
Now, set-car! does not change *list* structure (i.e., it does not change
the spine of a list), but it can change *tree* structure, if trees are
implemented as using pairs whose cars point one way and cdrs point the
other. However, none of the functions in the standard use trees based on
pairs. Furthermore, trees can be implemented using vectors or records,
but vector-set! and mutable records have not been treated in the same
way as set-car!
As far as I can tell (and I would appreciate being corrected if I am
wrong), the only R6RS standard function thigh might be compromised by
set-car! is assp; the procedure argument might mutate the association
list argument. However, dealing with this possibility in the
implementation is fairly straightforward and does not seem to involve a
great sacrifice of performance.
So, is set-car! banished along with set-cdr! because:
(a) It is guilty by association with set-cdr!;
(b) The Editors worry about assp;
(c) The Editors worry about non-standard procedures that might be
compromised by set-car!
(d) Some other reason that I don't understand.
Regards,
Alan
Received on Fri Jun 22 2007 - 13:40:43 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC