Hello all

I just came up with a way of executing multiple folds in a single
pass. In short, we can write code like this:

   average = foldLeft $ (/) <$> sumF <*> lengthF

and it will only traverse the input list once.

The code is at: https://gist.github.com/2802644

My question is: has anyone done this already? If not, I might release
this on Hackage -- it seems quite useful.

Chris

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to