Skip to content

Instantly share code, notes, and snippets.

@VienosNotes
Created November 19, 2012 11:09
Show Gist options
  • Select an option

  • Save VienosNotes/4110148 to your computer and use it in GitHub Desktop.

Select an option

Save VienosNotes/4110148 to your computer and use it in GitHub Desktop.
let diff xs ys =
let rec internal xs ys ans =
match xs with
| hd::tl ->
if List.mem hd ys then internal tl ys ans
else internal tl ys (ans @ [hd])
| _ -> ans
in
internal xs ys [];;
diff [1;2;3;4;5;6] [2;4;6];;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment