Created
December 22, 2016 20:06
-
-
Save deque-blog/dd46126888dbdd86a95a75a1e176efa0 to your computer and use it in GitHub Desktop.
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
merge :: (Ord a) => [a] -> [a] -> [a] | |
merge xs [] = xs | |
merge [] ys = ys | |
merge l@(x:xs) r@(y:ys) | |
| y < x = y : merge l ys -- Keeps it stable | |
| otherwise = x : merge xs r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment