title: Scala median function for Int and Long
body: <p>I am new to scala language and was trying to implement the median function which should work for Int and Long both, this is what I tried to do: </p>
  
  <pre><code> def getMedian[T: Numeric](seq: Seq[T]): T = {
        val sortedSeq = seq.sortWith(_ &lt; _)
        if (seq.size % 2 == 1) sortedSeq(sortedSeq.size / 2)  else {
              val (up, down) = sortedSeq.splitAt(seq.size / 2)
              (up.last + down.head) / 2
         }
    }
  </code></pre>
  
  <p>but the comparison operator is not valid for numeric class. What can I do to accomplish this.</p>