[plt-scheme] mreverse!

From: praimon (praimon at gmail.com)
Date: Sat Jan 24 16:19:20 EST 2009

Okay, so I definitely don't understand the point of mreverse!
How is it different from
(define mreverse!
    (lambda (l)
      (let ([rev (mreverse l)])
        (set-mcdr! l null)

On Sat, Jan 24, 2009 at 4:06 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
> mreverse! reverses the list values, it does NOT change the association
> between any identifier and the value. Just imagine this:
>  (define a (mlist 1 2 3 4))
>  (define b a)
>  (define c b)
>  (define d a)
>  (define e c)
>  > (mreverse! d)

I don't understand the point here either. When I apply my own
destructive reverse here:
>{4 3 2 1}
Why is that wrong?


Posted on the users mailing list.