[Haskell-cafe] lazy evaluation is not complete
Robin Green
greenrd at greenrd.org
Sun Feb 8 13:56:19 EST 2009
On Mon, 09 Feb 2009 15:10:22 +0100
Peter Padawitz <peter.padawitz at udo.edu> wrote:
> A simplied version of Example 5-16 in Manna's classical book
> "Mathematical Theory of Computation":
>
> foo x = if x == 0 then 0 else foo (x-1)*foo (x+1)
>
> If run with ghci, foo 5 does not terminate, i.e., Haskell does not
> look for all outermost redices in parallel. Why? For efficiency
> reasons?
I believe * is implemented in the normal way and thus is always strict
in both arguments.
More information about the Haskell-Cafe
mailing list