Skip to content

Commit

Permalink
Add iterate for Reverse{<:NamedTuple}
Browse files Browse the repository at this point in the history
Fixes the problem mentioned in JuliaLang#42991 (comment)
  • Loading branch information
bkamins authored Nov 11, 2021
1 parent c25b704 commit 7c9a4df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ reverse(r::Reverse) = r.itr
reverse(x::Union{Number,AbstractChar}) = x
reverse(p::Pair) = Base.reverse(p) # copying pairs is cheap

iterate(r::Reverse{<:Tuple}, i::Int = length(r.itr)) = i < 1 ? nothing : (r.itr[i], i-1)
iterate(r::Reverse{<:Union{Tuple, NamedTuple}}, i::Int = length(r.itr)) = i < 1 ? nothing : (r.itr[i], i-1)

# enumerate

Expand Down

0 comments on commit 7c9a4df

Please sign in to comment.