[Haskell-cafe] Strict evaluation not working?

Christian Hofer Christian.Hofer at gmx.de
Tue Oct 12 13:02:36 EDT 2004


Am 12.10.2004 um 18:20 schrieb Keith Wansbrough:
> But if you are just learning Haskell, you almost certainly don't need
> to do this.  Just make use of the laziness, and learn to love it!
>
Thank you for your replies. You are right: I don't need it. It's just 
that I am currently studying the book Algorithms by Rabhi/Lapalme, and 
in their section about tail recursivity optimization they write:

"Note that in a lazy language, this optimization only works if the 
parameters of the recursive call are strictly evaluated. If not, the 
space occupied by the old function call cannot be reused since it 
contains references to unevaluated arguments." (p. 67)

For me, "seq" does not seem to solve the problem, then: I can still 
have a partly unevaluated argument that is bound to the environment of 
the calling function.

Is this correct?

Chris



More information about the Haskell-Cafe mailing list