Skip to content

tcollect fails with nested generators #113

Open
@juliohm

Description

@juliohm

MWE:

using Transducers
using OhMyThreads

f(xs) = Transducers.tcollect(abs(x) for x in xs)
g(xs) = OhMyThreads.tcollect(abs(x) for x in xs)

f((x for x in rand(100))) # works as expected
g((x for x in rand(100))) # fails with the error below
ERROR: MethodError: no method matching tmap(::typeof(identity), ::Base.Generator{Base.Generator{Vector{Float64}, typeof(identity)}, var"#13#14"})

Closest candidates are:
  tmap(::Any, ::Union{ChunkSplitters.Chunk, AbstractArray}, AbstractArray...; scheduler, kwargs...)
   @ OhMyThreads ~/.julia/packages/OhMyThreads/PtzLw/src/implementation.jl:323
  tmap(::Any, ::Type{T}, ::AbstractArray, ::AbstractArray...; kwargs...) where T
   @ OhMyThreads ~/.julia/packages/OhMyThreads/PtzLw/src/implementation.jl:318

Stacktrace:
 [1] tcollect(A::Base.Generator{Base.Generator{Vector{Float64}, typeof(identity)}, var"#13#14"}; kwargs::@Kwargs{})
   @ OhMyThreads.Implementation ~/.julia/packages/OhMyThreads/PtzLw/src/implementation.jl:472
 [2] g(xs::Base.Generator{Vector{Float64}, typeof(identity)})
   @ Main ./REPL[23]:1
 [3] top-level scope
   @ REPL[27]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions