
28 Mar
2009
28 Mar
'09
10:58 a.m.
2009/3/27 Edward Z. Yang
Hello all,
Hi
average :: Fractional a => [a] -> a average list = sum list / fromIntegral (length list)
There was a thread on this ML which was about an implementation of average which avoids traversing the list twice, one for 'sum' and one for 'length'. You could use it, if you care for performance and your list is long enough to matter Ciao ---------- FB