
26 Sep
2010
26 Sep
'10
12:20 p.m.
Type signature would be Int -> [Double] -> [(Double,Double)] Any thoughts or ideas on how to calculate a n-element moving average of a list of Doubles? Let's say [1..10]::[Double] what is the function to calculate the average of the 3 elements? [(1,0),(2,0),(3,2),(4,3)....] :: [(Double,Double)] (1,0) the average is zero as the length is less than 3 (2,0) the average is zero as the length is less than 3 (3,2) the average is (1+2+3)/3 = 2 (4,3) the average is (2+3+4)/3 = 9 ......