[Haskell-begin] Re: For starters...

Chaddaï Fouché chaddai.fouche at gmail.com
Fri Jul 18 08:01:23 EDT 2008

2008/7/17 Rafael Gustavo da Cunha Pereira Pinto <rafaelgcpp at gmail.com>:
> I will use foldr max 0, because I want 0 for the empty list.

In this case use rather "foldl' max 0", using foldr you would have to
construct a huge thunk of max application before getting your result
whereas foldl' max will find the answer in constant space (and quite a
bit faster). This wiki page will explain the difference between the
folds :


More information about the Beginners mailing list