Created
November 23, 2014 15:28
-
-
Save jergason/f16c19f68a9aebbe6372 to your computer and use it in GitHub Desktop.
quicksort in haskell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- see http://learnyouahaskell.com/recursion#quick-sort | |
quicksort' :: (Ord a) => [a] -> [a] | |
quicksort' [] = [] | |
quicksort' (x:xs) = | |
let biggerSorted = quicksort' [a | a <- xs, a > x] | |
smallerSorted = quicksort' [a | a <- xs, a <= x] | |
in smallerSorted ++ [x] ++ biggerSorted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment