let a = [1;2;3;] for i in (a |> Seq.take 10) do Console.WriteLine(i) for i in (a |> Seq.take 100) do Console.WriteLine(i)
The first line works well, but the second line gives an error: The input sequence has an insufficient number of elements.
Yes, there are no 100 elements, there are only 3 of them, but why does 10 work?
Online test
because it works in C #
using System; using System.Linq; class P { static void Main() { var p = new[] {1,2,3,4}; foreach(var i in p.Take(10).ToArray()) Console.WriteLine(i); foreach(var i in p.Take(2).ToArray()) Console.WriteLine(i); foreach(var i in p.Take(100).ToArray()) Console.WriteLine(i); }}
Online test
source share