Created
January 21, 2015 12:16
-
-
Save shigemk2/6acd5ad8c20a71f0e9c1 to your computer and use it in GitHub Desktop.
This file contains 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
quicksort :: (Ord a) => [a] -> [a] | |
quicksort [] = [] | |
quicksort (x:xs) = | |
let smallerOrEqual = filter (<= x) xs | |
larger = filter (> x) xs | |
in quicksort smallerOrEqual ++ [x] ++ quicksort larger | |
main = do | |
print $ quicksort [4,3,2,1,0,6,9,8,7,10] | |
print $ quicksort $ filter (> 5) [4,3,2,1,0,6,9,8,7,10] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment