3

Qsort. Classic haskell. Feels great.

Comments
  • 0
    qsort([]) -> [];
    qsort([H|T]) -> qsort([ X || X <- T, X < H ]) ++ [H] ++ qsort([ X || X <- T, X >= H ]).

    Erlang. ;)
  • 0
    @firusvg great, looks similar, but less explicit
  • 1
    @twist900 It's, basically, the same in all functional programming languages (also in imperative and OO languages using recursion). I've used list comprehensions as that produce much clearer (compact, too) code.
Add Comment