-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavioriterationInvolves iteration or the iteration protocolInvolves iteration or the iteration protocol
Description
MWE:
julia> it = Iterators.cycle(Iterators.Stateful(1:3));
julia> z = zip(it, 1:10);
julia> length(z)
10
julia> collect(z)
10-element Vector{Tuple{Int64, Int64}}:
(1, 1)
(2, 2)
(3, 3)
(0, 0)
(0, 0)
(0, 0)
(0, 0)
(0, 0)
(0, 0)
(0, 0)The 7 last elements of the vector are un-initialized and therefore set to arbitrary values (which could include #undef elements!)
This happens because Iterators.cycle assumes its underlying iterator is stateless and can be resumed from the beginning by calling iterate.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavioriterationInvolves iteration or the iteration protocolInvolves iteration or the iteration protocol