JuliaFolds / Transducers.jl

Efficient transducers for Julia
https://juliafolds.github.io/Transducers.jl/dev/
MIT License
433 stars 24 forks source link

Enumerate doesn't work with tcollect #563

Open mrufsvold opened 11 months ago

mrufsvold commented 11 months ago

Enumerate doesn't increment when you use it with a tcollect

julia> a = collect(1:5);

julia> a |> Enumerate() |> collect
5-element Vector{Tuple{Int64, Int64}}:
 (1, 1)
 (2, 2)
 (3, 3)
 (4, 4)
 (5, 5)

julia> a |> Enumerate() |> tcollect
5-element Vector{Tuple{Int64, Int64}}:
 (1, 1)
 (1, 2)
 (1, 3)
 (1, 4)
 (1, 5)

If there is a technical reason that this can't work, then I think it should be documented that Enumerate doesn't work (or maybe list all the Transducers that are known to work with tcollect).