Last active
February 9, 2023 23:15
-
-
Save ruxo/d86a1cf7128784f89963 to your computer and use it in GitHub Desktop.
Split sequence into groups
This file contains hidden or 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
| // code from https://stackoverflow.com/questions/6736464/split-seq-in-f/6737659#6737659 | |
| let splitBy f input = | |
| let i = ref 0 | |
| input | |
| |> Seq.groupBy (fun x -> | |
| if f x then incr i | |
| !i) | |
| |> Seq.map snd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment