[plt-scheme] should `map' reuse cons cells?
Eli Barzilay writes:
> On May 26, Doug Orleans wrote:
> > Anyway, I think it would be nice for PLT's implementation of `map' to
> > reuse longest common tails. (Or at least PLT's implementation of
> > SRFI-1's version of `map'.) Thoughts?
>
> Wouldn't it be healthier to simply add a `map!'?
SRFI-1 has a `map!', but that's something different: it doesn't just
reuse cons cells from its input, it mutates them. I want a functional
`map', but one that doesn't create new cells for sublists if all the
elements are `eq?' to the original. Besides minimizing garbage, it
would speed up things like `equal?' later on (assuming it uses `eq?'
to shortcut).
--dougo at place.org