F# array_chunk for Sequence
问题 I'm having some trouble making a sequence. Basically I need to chop a sequence into a sequence of arrays. Seq.windowed almost does it but I don't want duplicate elements. I can get what I want by reading everything into an array first but I'd rather use a sequence. let array_chunk s (a:int[]) = Array.init (a.Length / s) (fun i -> Array.sub a (i * s) s) someSequence |> Seq.to_array |> array_chunk 5 回答1: Here's a nice imperative one that'll work with seq and generate arrays of any size. The