learning F#, it seems pretty cool, favourite functional language so far.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123456789101112131415 |
- let rec quicksort list =
- match list with
- | [] -> [] // Empty list
- | firstEl::tail ->
- let smallerEls =
- tail
- |> List.filter (fun e -> e < firstEl)
- |> quicksort
- let larger =
- tail
- |> List.filter (fun e -> e >= firstEl)
- |> quicksort
- smallerEls @ [firstEl] @ larger
-
- printfn "%A" (quicksort [1;5;23;18;9;1;3])
|