let slice nx xs = xs |> Seq.windowed (x + 1) |> Seq.nth n
Note that unlike Yacoder's answer, it returns an array instead of a sequence (which you may or may not need, depending on the situation).
I added my answer to show Seq.windowed
, a very useful IMHO function. Seq.pairwise
also nice and helpful to know.
source share