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
With tail-recursion
@tailrec def findMax(x: List[Int]):Int = x match { case a :: Nil => a case a :: b :: c => findMax( (if (a > b) a else b) ::c) }