13 Mar
2002
13 Mar
'02
8:12 a.m.
Hal Daume III:
Here's the basic idea. Suppose we have the function:
sum [] acc = acc sum (x:xs) acc = sum xs (acc+x)
This is tail recursive, but not strict in the accumulator argument. ...
Just a nitpick here. sum is indeed strict in its second argument (given that (+) is strict in its first argument). That is, sum l _|_ = _|_ for all possible lists l. It is of course possible that the compiler you use does not detect this and generates nonstrict code. But I think a decent strictness analyzer should detect this. Can the problem be that + is overloaded in Haskell, so the compiler cannot assume any semantical properties like strictness for it? Björn Lisper