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 Sca
def max(xs: List[Int]): Int = { def _max(xs: List[Int], maxAcc:Int): Int = { if ( xs.isEmpty ) maxAcc else _max( xs.tail, Math.max( maxAcc, xs.head ) ) // tail call recursive } if ( xs.isEmpty ) throw new NoSuchElementException() else _max( xs, Int.MinValue ); }