title: How to find the largest element in a list of integers recursively?
body: <p>I'm trying to write a function which will recursively find the largest element in a list of integers. I know how to do this in Java, but can't understand how to do this at Scala.</p>
  
  <p>Here is what I have so far, but without recursion: </p>
  
  <pre><code>  def max(xs: List[Int]): Int = {
      if (xs.isEmpty) throw new java.util.NoSuchElementException();
      else xs.max;
    }
  </code></pre>
  
  <p>How can we find it recursively with Scala semantic.</p>