The code is working well, but I got a wrong result when I try it for my example. The problem is this part in my example : [-9..10]. This columns avarage is 0.5, but I got 0 when I test it. The haskell use the empty list match pattern for this example, but I do not know why. How can I fix this ?
listAvg :: [Double] -> Double
listAvg [] = 0
listAvg x = (sum x)/fromIntegral(length x)
coldestAvg :: [[Double]] -> Double
coldestAvg [] = 0
coldestAvg (x:xs) = min (listAvg x) (coldestAvg xs)
Example :
coldestAvg [[12,13],[-9..10]] == 0.5