Averages/Simple moving average: Difference between revisions

→‎{{header|Haskell}}: comment comments
(→‎{{header|Haskell}}: More readable version, I hope)
(→‎{{header|Haskell}}: comment comments)
Line 1,263:
mean xs = sum xs / (genericLength xs)
 
--Usage: runningAvg p
--Argument: p is the number of consecutive floats to average; the period length.
--Value: a function that accepts a list of floats, and returns a list of the arithmetic mean of each period.
runningAvg :: Int -> [Float] -> [Float]
runningAvg _ [] = []
Anonymous user