Jeff Polakow wrote:
> Then, I immediately blow my stack if I try something like:
>> mean [1..1000000000].
>> The culprit is actually sum which is defined in the base libraries as
> either a foldl or a direct recursion depending on a compiler flag. In
> either case, the code is not strict enough; just trying to compute:
>> sum [1..10000000]
>> blows the stack. This can be easily fixed by defining a suitable
> strict sum:
>> sum' = foldl' (+) 0
>> and now sum' has constant space.
OK *now* I'm worried... I thought sum was _already_ defined this way? o_O