[Haskell-cafe] Spot the difference!
ajb at spamcop.net
ajb at spamcop.net
Thu Sep 20 01:33:29 EDT 2007
G'day all.
Quoting PR Stanley <prstanley at ntlworld.com>:
> Fully lazy? Can you elaborate please?
Sure. that code again:
test1 = \n _ -> 1+n
test2 = \n -> let x = n+1 in \_ -> x
Suppose we have:
f g x = g x + g x
And we try two options:
f (test1 4) 3
f (test2 4) 3
In the first case, (1+4) will be evaluated twice. In the second case, it
will only be evaluated once.
Cheers,
Andrew Bromage
More information about the Haskell-Cafe
mailing list