averages :: [Double] -> Double
averages xs = averages' xs 0.0 (length xs)
  where
    averages' [] r lim =
      r / fromIntegral lim
    averages' (x:xs) r lim =
      averages' xs (x+r) lim

------------------------------------------------------------------------------
averages :: [Double] -> Double
averages xs = averages' xs 0.0 (length xs)
  where
    averages' [] r lim =
      r / fromIntegral lim
    averages' (x:xs) r lim =
      averages' xs (x+r) lim

------------------------------------------------------------------------------
averages xs = averages' xs 0.0 (length xs)
  where
    averages' [] r lim =
      r / fromIntegral lim
    averages' (x:xs) r lim =
      averages' xs (x+r) lim

------------------------------------------------------------------------------