Iterate through iterator starting and ending at a specified value

It’s a bit clumsy, but something like this:

julia> dropends(it, start, stop) = Iterators.drop(Iterators.take(it, stop), start - 1)
dropends (generic function with 1 method)

julia> foreach(println, dropends(it, 2, 5))
(2, 1)
(3, 1)
(1, 2)
(2, 2)
2 Likes