QuickSort in 61 characters

My friend and colleague Mike Sollami, a programmer and mathematician, loves concision. A cute expression of this ideal is a very short implementation of the QuickSort algorthm that he wrote:

quicksort = # & @@@ {# //. x : {__} :> (## & @@ Reverse /@ GatherBy[x, (# < x[[1]] &)])} &

Of course this is a little opaque, looking perhaps more like APL than modern code. To make it easier to parse visually, I’ve used one of the many small utilities I’ve written for internal use here at Wolfram|Alpha, called SyntaxPlot, to lay out the abstract syntax tree of quicksort.

Syntax plot of QuickSort