JuliaFolds / Transducers.jl

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

Stateful transducers in MapCat lower incorrectly #499

Open ChiCubed opened 2 years ago

ChiCubed commented 2 years ago
julia> 1:10 |> MapCat(x -> x:10 |> TakeWhile(<=(5))) |> collect
5-element Vector{Int64}:
 1
 2
 3
 4
 5

It seems like the TakeWhile's state is not reset between "iterations of the loop". If you collect the inner eduction, you get the expected behaviour.