Note that this is something of an abuse of the implicit contract of getindex
that it is O(1).
The generic way to get the n
-th element of an Iterator x
is something like first(Iterators.drop(x, n-1))
. (I feel like we should have an Iterators.nth(x, n)
API for this?)