I have a little question about this piece of code (which does not compile) :
def avg(seq: Seq[Int]): Double = seq.sum.toDouble/seq.length
def avg(seq: Seq[Double]): Double = seq.sum/seq.length
the idea is simple as shown above, the first method calculates the average to a sequence of integers, and the second does the same to a seq of Doubles
but it gives me a compilation error around repetition, I want to know why...and if you have a much Scala approach than this code to perform the same idea please, share it in your answer Thank you