[Haskell-cafe] Re: curious about sum

2009-06-18 Thread Gleb Alexeyev
Thomas Davie wrote: No, I think it's extremely useful. It highlights that numbers can both be lazy and strict, and that the so called useless lazy sum, is in fact, useful. But lazy sum should have beed defined in terms of foldr, not foldl. And foldl is not strict enough for strict sum.

Re: [Haskell-cafe] Re: curious about sum

2009-06-18 Thread Edward Kmett
On Thu, Jun 18, 2009 at 9:14 AM, Gleb Alexeyev gleb.alex...@gmail.comwrote: Thomas Davie wrote: No, I think it's extremely useful. It highlights that numbers can both be lazy and strict, and that the so called useless lazy sum, is in fact, useful. But lazy sum should have beed defined in

Fwd: [Haskell-cafe] Re: curious about sum

2009-06-18 Thread Alberto G. Corona
However it does not work as I expected. I ´m interested in memory management. I though that ghci let l= [1..100] ghci foldl' (+) 0 l would produce a stack overflow, since the list can not be freed, because l points to the beginning of the list however it succeed My conclussion is that, in

Re: [Haskell-cafe] Re: curious about sum

2009-06-18 Thread Chaddaï Fouché
On Thu, Jun 18, 2009 at 6:38 PM, Alberto G. Coronaagocor...@gmail.com wrote: My question is: Why the process does not grow also in the lazy case and instead produces a stack overflow inmediately? This question is answered in detail on the Wiki

Re: [Haskell-cafe] Re: curious about sum

2009-06-18 Thread Alberto G. Corona
Very informative. The list is in the heap but the lazy sum of foldl is in the stack. ok.I suppose that all tail recursive functions are detected by the strictness analysis. 2009/6/18 Chaddaï Fouché chaddai.fou...@gmail.com On Thu, Jun 18, 2009 at 6:38 PM, Alberto G. Coronaagocor...@gmail.com