scala-codesheet-api
scala-codesheet-api copied to clipboard
pattern match / toString wtf
def quicksort(a: List[Int] = List(3,4,5,23,1,2,3,4)): List[Int] = {
if(a.isEmpty) Nil
else {
val (big, small) = a.tail.partition(_ > a.head)
quicksort(small) ::: (a.head :: quicksort(big))
}
}
quicksort(a = List(3, 4, 5, 23, 1, 2, 3, 4)) => else => {
x$1 = (List(4, 5, 23, 4),List(1, 2, 3)); big = List(4, 5, 23, 4); small = List(1, 2, 3)
{x$3 = List(1, 2, 3); List(1, 2, 3, 3, 4, 4, 5, 23)}
}