Skip to content

Instantly share code, notes, and snippets.

@NickLydon
Created March 26, 2014 22:17
Show Gist options
  • Save NickLydon/9794923 to your computer and use it in GitHub Desktop.
Save NickLydon/9794923 to your computer and use it in GitHub Desktop.
let splitIncludesAndExcludes =
searchPatterns |>
Seq.fold(fun (acc,collecting) next ->
match next with
| IncludeKey -> (acc, Include)
| ExcludeKey -> (acc, Exclude)
| next ->
match collecting with
| Skip -> (acc, collecting)
| Include ->
({ acc with Includes = next::acc.Includes }, Include)
| Exclude ->
({ acc with Excludes = next::acc.Excludes }, Exclude))
({ Includes = []; Excludes = []; }, Skip)
|> fst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment