[plt-scheme] scribblings on PLT Scheme 4.0
On 5/28/07, Eli Barzilay <eli at barzilay.org> wrote:
>
> My common !-operation is `reverse!' -- I use it very frequently to
> reverse a list result.
I'll do that as well if I know that the consing was done locally.
> I also use `append!', but that's less
> frequent.
I don't think I've ever wanted this one. I have used nreconc on occasion.
(nreconc foo bar) => (append! (reverse! foo) bar) , but more
efficiently. I feel dirty afterwards, though.
There are many advantages to not using side effects, though. Easier
debugging was mentioned, but you can get better performance and
smaller data structures by hash-consing and memoization, which you can
freely use if the code doesn't side effect.
--
~jrm