On Tue, Dec 29, 2009 at 12:04 AM, Jon Harrop <jon@ffconsultancy.com> wrote:

Forcing the evaluating of a thunk replaces the unevaluated expression with the
value it evaluates to. That is effectively in-place mutation.

How can one use that to gain on efficiency? I understand that laziness allows a modified data structure to share nodes with the original data structure preventing unnecessary copying, but I do not see how forcing an evaluation can be used to gain on efficiency (or alternatively prevent inefficiency). Is there any simple example to illustrate this (or should I read Okasaki)?

--
Thanks,
Gautam