JuliaFolds / Transducers.jl

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

Iterated followed by TakeWhile iterates more than it should #550

Open dimchee opened 1 year ago

dimchee commented 1 year ago

I tried using TakeWhile after Iterated, but Iterated function argument seems to be executed before condition of TakeWhile. Is this intentional?

julia> 1:10 |> Iterated(x -> (println("called with: $x"); x+1), 0) |> TakeWhile(x -> x < 3) |> collect
called with: 0
called with: 1
called with: 2
called with: 3
3-element Vector{Int64}:
 0
 1
 2