Skip to content

Instantly share code, notes, and snippets.

@JonCanning
Created July 8, 2022 09:08
Show Gist options
  • Save JonCanning/70ca7d4ac0db22d320f898fc1e12333d to your computer and use it in GitHub Desktop.
Save JonCanning/70ca7d4ac0db22d320f898fc1e12333d to your computer and use it in GitHub Desktop.
Dedupe items in a seq
let dedupe source =
seq {
let mutable previous = ValueNone
for item in source do
match previous with
| ValueSome x when x = item -> ()
| _ -> yield item
previous <- ValueSome item
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment