Skip to content

Instantly share code, notes, and snippets.

@luqui
Created December 29, 2011 03:25
Show Gist options
  • Save luqui/1531567 to your computer and use it in GitHub Desktop.
Save luqui/1531567 to your computer and use it in GitHub Desktop.
mergeEq :: (a -> a -> Ordering) -> [a] -> [a] -> [(a,a)]
mergeEq cmp (x:xs) (y:ys) =
case cmp x y of
EQ -> (x,y) : mergeEq cmp xs ys
LT -> mergeEq cmp xs (y:ys)
GT -> mergeEq cmp (x:xs) ys
mergeEq f _ _ = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment