Skip to content

Instantly share code, notes, and snippets.

@kunishi
Created January 29, 2014 10:17
Show Gist options
  • Select an option

  • Save kunishi/8685118 to your computer and use it in GitHub Desktop.

Select an option

Save kunishi/8685118 to your computer and use it in GitHub Desktop.
fun intersect(nil, _) = nil
| intersect(_, nil) = nil
| intersect(xa as x::xs, ya as y::ys) =
if x = y then x::intersect(xs, ys)
else if x < y then intersect(xs, ya)
else intersect(xa, ys) (* x > y *);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment