13 May
2009
13 May
'09
1:56 a.m.
On Tue, May 12, 2009 at 1:39 PM, Roman Leshchinskiy <rl@cse.unsw.edu.au> wrote:
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