title: scala sort a list by object parameter error
body: <p>Ok, I wouldn't be coming to You for help if I knew what to do, anyways, still having problems with my "program".</p>
  
  <pre><code>class Mark(val name: String, val style_mark: Double, val other_mark: Double) {}
  
  object Test extends Application
    {
    val m1 = new Mark("Smith", 18, 16);
    val m2 = new Mark("Cole", 14, 7);
    val m3 = new Mark("James", 13, 15);
    val m4 = new Mark("Jones", 14, 16);
    val m5 = new Mark("Richardson", 20, 19);
    val m6 = new Mark("James", 4, 18);
  
    val marks = List[Mark](m1, m2, m3, m4, m5, m6);
  
    def avg(xs: List[Double]) = xs.sum / xs.length
  
    val marksGrouped = marks.groupBy(_.name).map { kv =&gt; new Mark(kv._1, avg(kv._2.map(_.style_mark)), avg(kv._2.map(_.other_mark))) }
  
    val marksSorted = marksGrouped.sortWith((m1, m2) =&gt; m1._style_mark &lt; m2._style_mark)
  
    }
  </code></pre>
  
  <p>And this is the error I get: <code>error: value sortWith is not a member of scala.collection.immutable.Iterable[Mark]</code></p>