
18 Jul
2008
18 Jul
'08
12:01 p.m.
2008/7/17 Rafael Gustavo da Cunha Pereira Pinto
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 : http://www.haskell.org/haskellwiki/Foldr_Foldl_Foldl%27 -- Jedaï