Skip to content

Instantly share code, notes, and snippets.

@ElemarJR
Created June 22, 2011 16:39
Show Gist options
  • Save ElemarJR/1040500 to your computer and use it in GitHub Desktop.
Save ElemarJR/1040500 to your computer and use it in GitHub Desktop.
quicksort em Haskell
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