I have to do the following recursive function, but it throws me error. What's wrong?
promedio :: [Int] -> Int, que toma una lista de numeros y calcula el valor pro-
medio (truncado, usando division entera).
promedio :: [Int] -> Int
promedio[]= 0
promedio (x:xs) = x /(length xs) + promedio (xs)
This error appears on the console:
Main > average1 [2, 3, 3, 5, 7, 10] *** Exception: divide by zero
and I had to use div instead of / because I got a lot of errors