[R6RS] Re: Zapping SET-CAR! & SET-CDR!

Michael Sperber sperber
Mon Oct 18 13:38:41 EDT 2004

>>>>> "Manuel" == Manuel Serrano <Manuel.Serrano at sophia.inria.fr> writes:

Manuel> I'm strongly against this proposal. In my opinion, mutable
Manuel> pairs is strong characteristic of Lisp. It enables efficient,
Manuel> and sometime simpler, implementation of tree manipulation.

But these could be done with 2-element vectors as well.  If you're
concerned about conciseness, you could do

(define (kons x y) (vector x y))
(define (kar x) (vector-ref x 0))
(define (kdr x) (vector-ref x 1))
(define (set-kar! x v) (vector-set! x 0 v))
(define (set-kdr! x v) (vector-set! x 1 v))

Moreover, I would think that the efficiency benefits of having only
immutable pairs would outweight those you cite.  Maybe Kent and Will
could comment?

Manuel> This is because Lisp and Scheme do have side effects on variables and
Manuel> data structures that I have always preferred them to, let's say, CAML.

I like mutable variable bindings as well.

Cheers =8-} Mike
Friede, V?lkerverst?ndigung und ?berhaupt blabla

More information about the R6RS mailing list