
23 Apr
2010
23 Apr
'10
5:45 a.m.
Roman Leshchinskiy wrote:
Hmm, I'd love to see some real-world uses of foldl. I have no idea what to optimise it for in vector. Unfortunately, the link above doesn't give any examples.
Here a use of foldl from the Haskell98 Prelude: reverse :: [a] -> [a] reverse = foldl (flip (:)) [] Basically, foldl is useful if the accumulating parameter uses equal or more space if evaluated to normal form than the input list. Regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com