Skip to content

pattern match / toString wtf #24

@MasseGuillaume

Description

@MasseGuillaume
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)}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions