Skip to content

Instantly share code, notes, and snippets.

@neilmock
Created October 23, 2017 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilmock/c02b77657badf0e497d2ee2d0da8d5bf to your computer and use it in GitHub Desktop.
Save neilmock/c02b77657badf0e497d2ee2d0da8d5bf to your computer and use it in GitHub Desktop.
let rec merge x y =>
switch (x, y) {
| ([], l) => l
| (l, []) => l
| ([hx, ...tx], [hy, ...ty]) =>
if (hx < hy) {
[hx, ...merge tx [hy, ...ty]]
} else {
[hy, ...merge [hx, ...tx] ty]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment