Alright. Here's the "Haskell" Quicksorter done in "quicksorting across the universe" as a Python one liner:
qsort = lambda x: x != [] and (qsort([ lt for lt in x[1:] if lt < x[0] ]) + [x[0]] + qsort([ gte for gte in x[1:] if gte >= x[0] ])) or x
In formatted mode:
qsort = lambda x: x != [] and \
(qsort([ lt for lt in x[1:] if lt < x[0] ]) +
[x[0]] +
qsort([ gte for gte in x[1:] if gte >= x[0] ])
) or x
qsort [] = []
qsort (x:xs) = qsort elts_lt_x ++ [x] ++ qsort elts_greq_x
where
elts_lt_x = [y | y <- xs, y < x]
elts_greq_x = [y | y <- xs, y >= x]
I found a Python version at ActiveState's ASPN, but my version is much more fascinating.I think it might have gotten lost in the move... I'll try to recreate it tonight.