Pair up elements of a sequence without overlap
Here's another way:

[| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10|]
|&gt; Seq.chunkBySize 2
|&gt; Seq.choose (function [|x; y|] -&gt; Some (x, y) | _ -&gt; None)


So, chunkBySize will create a sequence like seq [ [|1; 2|]; [|3; 4|]; .. ]

Then choose will try to match each element of the sequence with an array of two elements, everything else will be filtered out, which accounts for a trailing array of a single element if the input length is not even.

It could be even shorter by changing the last line to:

|&gt; Seq.collect Array.pairwise


Which would map pairwise to the each element, transforming for instance [|1;2|] to [|(1;2)|] and it will return [||] when there are less than two elements. So this will return a sequence of an array but since I'm using collect it will concatenate all elements. Since single elements were transformed to empty arrays it will concatenate nothing in those cases, if you think about it this is similar to the mechanics of choose.