[Haskell-begin] Exercises for beginners and Natural Tansformations
chaddai.fouche at gmail.com
Sat Jul 19 16:41:31 EDT 2008
2008/7/19 Chaddaï Fouché <chaddai.fouche at gmail.com>:
> 2008/7/19 Federico Brubacher <fbrubacher at gmail.com>:
>> One more thing to see if I have the fold thing correct :
>> - foldr is good because it's lazy but is not tail recursive
>> - foldl is tail recursive so less stack space but not lazy so not good on
>> infinite lists
>> - foldl' is a mix of the good thing of both , so it is lazy and tail
>> Am I right ?
> No... Did you read the link I gave you ? The explanation there is pretty good.
> First foldr and foldl are both lazy. foldl' is strict in the accumulator.
Ok, I'm confusing this with another discussion, sorry... ^^
The link I was speaking about is :
(But the things I said about the folds are still true :-)
PS : ajb, thank you for the explanation, it was very clear !
More information about the Beginners