
23 Apr
2010
23 Apr
'10
6 a.m.
On 23/04/2010, at 19:45, Heinrich Apfelmus wrote:
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.
What would change if this used foldl' instead? Roman