Saturday, November 22, 2014

Quick sort in Haskell

Haskell can be very beautiful:

quicksort [] = []
quicksort (x:xs) = quicksort smaller ++ [x] ++ quicksort greater
where
smaller = [a | a <- xs, a <= x]
greater = [b | b <- xs, b > x]
view raw quicksort.hs hosted with ❤ by GitHub

No comments:

Post a Comment