Skip to content

Instantly share code, notes, and snippets.

@adamchester
Last active August 29, 2015 14:02
Show Gist options
  • Save adamchester/cdabfc76d76c3a641698 to your computer and use it in GitHub Desktop.
Save adamchester/cdabfc76d76c3a641698 to your computer and use it in GitHub Desktop.
Except (faster; set-based)
let except ex all = all |> Seq.filter (not << Set.ofSeq(ex).Contains)
let filtered = [| 1..1000000 |] |> except [| 20..29 |]
@adamchester
Copy link
Author

better version as suggested by @rbartelink:

let except ex = Seq.filter (not << (Set.ofSeq ex).Contains)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment