[plt-scheme] mreverse!

From: praimon (praimon at gmail.com)
Date: Sat Jan 24 18:55:52 EST 2009

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)
>
> How do you think a function should find ALL possible pointers to the list
> and ensure that they now point to the other end? (This is an unsolvable
> problem by the way.)

Prof Felleisen, let me try again to understand.

> (my-mreverse! d)
{4 3 2 1}
> d
{4 3 2 1}
> a
{4 3 2 1}
> b
{4 3 2 1}
> c
{4 3 2 1}
> e
{4 3 2 1}

I'm confused as to whether the above results are correct, incorrect,
or just lucky.
(I'm guessing lucky)

regards,
praimon


Posted on the users mailing list.