Last active
July 2, 2020 13:57
-
-
Save medigor/7b0254d6e2c9d4fdf75162d35af64f29 to your computer and use it in GitHub Desktop.
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
module Seq = | |
let chunkBy f source = | |
seq { | |
let chunk = ResizeArray() | |
for x in source do | |
if (chunk.Count <> 0) && (f x) then | |
chunk.ToArray() | |
chunk.Clear() | |
chunk.Add(x) | |
if chunk.Count <> 0 then | |
chunk.ToArray() | |
} |
Author
medigor
commented
Jul 2, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment