Skip to content

Instantly share code, notes, and snippets.

@aluink
Forked from snluu/MergeList1.cs
Created October 5, 2012 20:29
Show Gist options
  • Save aluink/3842191 to your computer and use it in GitHub Desktop.
Save aluink/3842191 to your computer and use it in GitHub Desktop.
In Haskell
merge :: Ord a => [a] -> [a] -> [a]
merge [] l2 = l2
merge l1 [] = l1
merge xx@(x:xs) yy@(y:ys) = if x < y then x : merge xs yy
else y : merge xx ys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment