Created
December 22, 2015 09:41
-
-
Save yoshiki/f5900d90f48249a86b78 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
bswap [x] = [x] | |
bswap (x:y:zs) | |
| x < y = y : bswap (x:zs) | |
| otherwise = x : bswap (y:zs) | |
bsort :: (Ord a) => [a] -> [a] | |
bsort [] = [] | |
bsort [x] = [x] | |
bsort xs = y : bsort ys | |
where | |
(y:ys) = reverse (bswap xs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment