Skip to content

Instantly share code, notes, and snippets.

@baransu
Created September 24, 2016 17:51
Show Gist options
  • Save baransu/586677a48846119dd118586c0cb991a8 to your computer and use it in GitHub Desktop.
Save baransu/586677a48846119dd118586c0cb991a8 to your computer and use it in GitHub Desktop.
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) =
let smallerOrEqual = [a | a <- xs, a <= x]
larger = [a | a <- xs, a > x]
in quicksort smallerOrEqual ++ [x] ++ quicksort larger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment