Skip to content

Instantly share code, notes, and snippets.

@davidgrenier
Created October 13, 2013 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidgrenier/6967899 to your computer and use it in GitHub Desktop.
Save davidgrenier/6967899 to your computer and use it in GitHub Desktop.
let numBuffers = 50
[1; 2; 3; 4; 5]
|> Seq.mapi (fun i x -> i, x)
|> Seq.groupBy (fun (i, _) -> i % numBuffers)
|> Seq.map (fun (_, group) -> group |> Seq.map snd |> Seq.toArray)
|> Seq.toArray
let bufferSize = 500
[1; 2; 3; 4; 5]
|> Seq.mapi (fun i x -> i, x)
|> Seq.groupBy (fun (i, _) -> i / bufferSize)
|> Seq.map (fun (_, group) -> group |> Seq.map snd |> Seq.toArray)
|> Seq.toArray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment