Created
September 19, 2012 06:32
-
-
Save klapaucius/3748017 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
> :{ | |
let merge xs [] = xs | |
merge [] ys = ys | |
merge (x:xs) (y:ys) | x < y = x: merge xs (y:ys) | |
| otherwise = y: merge (x:xs) ys | |
:} | |
> :set -XNoMonomorphismRestriction | |
> let mergeAll = foldr1 merge | |
> take 20 $ mergeAll [[5..],[1..],[3..],[7..],[2..],[1..]] | |
[1,1,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,5,6,6] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment