[Haskell-cafe] More on performance
Ketil Malde
ketil at malde.org
Wed Jun 4 05:49:49 EDT 2008
Henning Thielemann <lemming at henning-thielemann.de> writes:
> Now the difficult question: How to write the 'mean' function in terms of
> 'sum' and 'length' while getting the same performance?
Write a RULE pragma converting
\xs -> (foldl' f y0 xs,foldl' g z0 xs)
into
\xs -> foldl' (\(y,z) x -> (f y x,g z x)) (y0,z0) xs
?
To actually work, it'd have to work for arbitrary top level function,
not just the (,) constructor. No idea if it's feasible at all, of
course :-)
-k
--
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe
mailing list