title: How to implement generic average function in scala?
body: <p>It seems easy problem for any specific kind of Number i.e. Double/Integer but it is hard to write in general case.</p>
  
  <pre><code>implicit def iterebleWithAvg(data:Iterable[Double]) = new {
      def avg:Double = data.sum / data.size
  }
  </code></pre>
  
  <p>How to implement this for any kind of Number(Int,Float,Double,BigDecemial)?</p>