
12 May
2009
12 May
'09
5:56 p.m.
On Tue, May 12, 2009 at 1:39 PM, Roman Leshchinskiy
let xs = map f ys in (sum xs, product xs)
the elements of xs will be computed once if it is a list but twice if it is a stream.
If you're using lists for loops rather than data, that's what you want (what you probably really want is cfoldl' ((,) <$> sumF <*> productF) xs, in terms of combinable folds).
Roman
--Max