Is there a version of "enumerate" in the reverse order?

I would like to enumerate an iterator with known length in reverse order. Something like:

julia> for t in enumerate(["a","b","c"], reverse=true); println(t); end
(3, "c")
(2, "b")
(1, "a")

Is there something builtin? For the moment, I build a vector and reverse it and iterate and change the index with “length - i” but it’s bad because I do not benefit from it being an iterator.

julia> for t in Iterators.reverse(enumerate(["a","b","c"])); println(t); end
(3, "c")
(2, "b")
(1, "a")
7 Likes

love it :heart: