Created
May 18, 2014 10:23
-
-
Save AlexMost/19ddd0894f74a3896630 to your computer and use it in GitHub Desktop.
qsort
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
qsort [] = [] | |
qsort (x:xs) = qsort less ++ [x] ++ qsort more | |
where (less, more) = foldr (\el (l, m) -> if el <= x then (el:l, m) else (l, el:m)) ([], []) xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment