4 ms·
The example given in the article can be addressed by using foldl' instead of foldr. The issue is discussed in http://www.haskell.org/haskellwiki/Foldr_Foldl_Fo
by T_S_ 18y ago
The example given in the article can be addressed by using foldl' instead of foldr. The issue is discussed in
http://www.haskell.org/haskellwiki/Foldr_Foldl_Foldl http://www.haskell.org/haskellwiki/Foldr_Foldl_Foldl
A Haskell programmer needs to understand when non-strict evaluation can/should be avoided. foldr is usually more elegant but sometimes less efficient.
- Deestan 18y agoYour link is missing the ' at the end. http://www.haskell.org/haskellwiki/Foldr_Foldl_Foldl%27 http://www.haskell.org/haskellwiki/Foldr_Foldl_Foldl%27