How erlang just blew my mind


qsort([]) -> [];
qsort([Pivot|T]) -> qsort([X || X <- T, X < Pivot])
++ [Pivot] ++
qsort([X || X <- T, X >= Pivot]).


(taken from 'Programming Erlang' by the pragmatic programmers).

That's just...beautiful. Quicksort in 4 lines. Nothing extraneous, just the pure recursive algorithm.

Erlang is bending my mind, but that's okay...it needs a little kick every so often.

Comments

Popular posts from this blog

Review: The Southeast Christian Church Easter Pageant

Rant On getting smacked down...

"Spiderman 3"...WHY?!