in reply to Haskell-style list folding
If I'm reading it right, your foldl routine is essentially the same as reduce() from List::Util.