Skip to content

Instantly share code, notes, and snippets.

@medigor
Last active July 2, 2020 13:57
Show Gist options
  • Save medigor/7b0254d6e2c9d4fdf75162d35af64f29 to your computer and use it in GitHub Desktop.
Save medigor/7b0254d6e2c9d4fdf75162d35af64f29 to your computer and use it in GitHub Desktop.
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()
}
@medigor
Copy link
Author

medigor commented Jul 2, 2020

изображение

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