Last active
July 6, 2020 12:37
-
-
Save deviousasti/dcc8684b77877bad73ea734825fd7455 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let createComparer (map) = | |
{ | |
new EqualityComparer<_>() with | |
override this.Equals(a, b) = Unchecked.equals (map a) (map b) | |
override this.GetHashCode(a) = Unchecked.hash (map a) | |
} | |
module Seq = | |
let exceptWith map first second = | |
Enumerable.Except(first, second, createComparer map) | |
(* | |
Example: | |
> [(1, 2); (3, 4)] |> Seq.exceptWith fst [(1, 3); (5, 7)];; | |
val it : IEnumerable<int * int> = seq [(5, 7)] | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment