[Haskell-cafe] curious about sum
Jochem Berndsen
jochem at functor.nl
Sat Jun 13 10:09:28 EDT 2009
Keith Sheppard wrote:
> Is there any reason that sum isn't strict? I can't think of any case
> where that is a good thing.
>
> Prelude> sum [0 .. 1000000]
> *** Exception: stack overflow
It is useful if the (+) is nonstrict; although I cannot think of any
useful mathematical structure where (+) would be nonstrict.
Regards,
--
Jochem Berndsen | jochem at functor.nl
GPG: 0xE6FABFAB
More information about the Haskell-Cafe
mailing list