Iterators do [1..]

The following picture probably doesn't surprise you

But as you can see in what is commented out, you can indeed e.g. do

DataSource.Take(10).ToList

Such an iterator then has quite a similarity to Haskell's [1..], the infinite list. Just make sure that you don't pull all elements from the source...

Creative Commons License

Frank Quednau 2021