G'day all.

On Tue, 3 May 2005 21:04:46 -0700
Andrew Pimlott <[EMAIL PROTECTED]> wrote:

> > The advantage of lazy evaluation is that evaluation order becomes one
> > less thing you have to think about.

Quoting Erik de Castro Lopo <[EMAIL PROTECTED]>:

> Yes, but only if your functions are pure.

Right.

> >  The disadvantage of lazy evaluation
> > is that evaluation order becomes one more thing you have to think about.
>
> Yes, but only if your functions are impure.

Wrong.  An unevaluated thunk can, in general, be much larger than what
the thunk evaluates to.  (Think of "length" of a large list, for example.)
If such a thunk is unevaluated but not garbage for a considerable time,
then you have a space leak.

So you do need to think about evaluation order.  One good rule of thumb
is: On large data structures, try to have a single consumer only.

Cheers,
Andrew Bromage
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to