Selection Sort Implementation in Scala