Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProgressLoggingFoldable missing size method #521

Open
sethaxen opened this issue Apr 24, 2022 · 0 comments
Open

ProgressLoggingFoldable missing size method #521

sethaxen opened this issue Apr 24, 2022 · 0 comments

Comments

@sethaxen
Copy link

To use withprogress with Folds.jl, the method size needs to be implemented for it.

julia> using Folds, Transducers

julia> Folds.collect(withprogress(1:3))
ERROR: MethodError: no method matching size(::Transducers.ProgressLoggingFoldable{UnitRange{Int64}})
Closest candidates are:
  size(::Union{LinearAlgebra.Adjoint{T, var"#s859"}, LinearAlgebra.Transpose{T, var"#s859"}} where {T, var"#s859"<:(AbstractVector)}) at ~/.julia/juliaup/julia-1.7.2+0~x64/share/julia/stdlib/v1.7/LinearAlgebra/src/adjtrans.jl:172
  size(::Union{LinearAlgebra.Adjoint{T, var"#s859"}, LinearAlgebra.Transpose{T, var"#s859"}} where {T, var"#s859"<:(AbstractMatrix)}) at ~/.julia/juliaup/julia-1.7.2+0~x64/share/julia/stdlib/v1.7/LinearAlgebra/src/adjtrans.jl:173
  size(::Union{LinearAlgebra.QR, LinearAlgebra.QRCompactWY, LinearAlgebra.QRPivoted}) at ~/.julia/juliaup/julia-1.7.2+0~x64/share/julia/stdlib/v1.7/LinearAlgebra/src/qr.jl:567
  ...
Stacktrace:
 [1] reshape_as(ys::Vector{Int64}, xs::Transducers.ProgressLoggingFoldable{UnitRange{Int64}}, #unused#::Base.HasShape{1})
   @ Folds.Implementations ~/.julia/packages/Folds/ZayPF/src/collect.jl:19
 [2] reshape_as(ys::Vector{Int64}, xs::Transducers.ProgressLoggingFoldable{UnitRange{Int64}})
   @ Folds.Implementations ~/.julia/packages/Folds/ZayPF/src/collect.jl:17
 [3] collect(itr::Transducers.ProgressLoggingFoldable{UnitRange{Int64}}, ex::ThreadedEx{NamedTuple{(), Tuple{}}})
   @ Folds.Implementations ~/.julia/packages/Folds/ZayPF/src/collect.jl:12
 [4] collect(itr::Transducers.ProgressLoggingFoldable{UnitRange{Int64}}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Folds.Implementations ~/.julia/packages/Folds/ZayPF/src/collect.jl:1
 [5] collect(itr::Transducers.ProgressLoggingFoldable{UnitRange{Int64}})
   @ Folds.Implementations ~/.julia/packages/Folds/ZayPF/src/collect.jl:1
 [6] top-level scope
   @ REPL[3]:1

julia> Base.size(x::Transducers.ProgressLoggingFoldable) = size(x.foldable)

julia> Folds.collect(withprogress(1:3))
3-element Vector{Int64}:
 1
 2
 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant