[plt-scheme] should `map' reuse cons cells?

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Wed May 26 16:47:45 EDT 2004

Doug Orleans wrote:
> According to the SRFI-1 notes about its reference implementation:
>   Functions reuse longest common tails from input parameters to
>   construct their results where possible.
> Shouldn't that mean that the following should be true?
>   > (define l (list 1 2 3))
>   > (eq? l (map identity l))
>   #f


The function map have can't determine whether the given function
behaves like the identity on all elements of the list without
first building a list with the mapped elements and then compare
this list to the original.

The note is there to make sure that those functions where one
expects common tails to be reused (e.g. drop) actually
does reuse.

In other words, I interpret the "where possible" not to mean
"theoretically possible" but to mean "possible without speed
or memory sacrifices".

Jens Axel Søgaard

Posted on the users mailing list.