When I try to run the following code
using Combinatorics
using Base.Threads
five_letter_words = ["taxis", "deans", "krone", "unset", "other", "ovens", "spilt", "yanks", "flout", "clang"]
@threads :static for combo in combinations(five_letter_words, 5)
if length(intersect(combo)==0)
println(combo)
end
end
I get the following error
ERROR: TaskFailedException
Stacktrace:
[1] wait
@ ./task.jl:334 [inlined]
[2] threading_run(func::Function)
@ Base.Threads ./threadingconstructs.jl:38
[3] top-level scope
@ ./threadingconstructs.jl:97
nested task error: MethodError: no method matching firstindex(::Base.Generator{Combinatorics.Combinations, Combinatorics.var"#10#13"{Combinatorics.var"#reorder#11"{Vector{String}}}})
Closest candidates are:
firstindex(::Any, ::Any) at ~/packages/julias/julia-1.7/share/julia/base/abstractarray.jl:396
firstindex(::Tuple) at ~/packages/julias/julia-1.7/share/julia/base/tuple.jl:25
firstindex(::Number) at ~/packages/julias/julia-1.7/share/julia/base/number.jl:88
...
Stacktrace:
[1] (::var"#83#threadsfor_fun#8"{Base.Generator{Combinatorics.Combinations, Combinatorics.var"#10#13"{Combinatorics.var"#reorder#11"{Vector{String}}}}})(onethread::Bool)
@ Main ./threadingconstructs.jl:70
[2] (::var"#83#threadsfor_fun#8"{Base.Generator{Combinatorics.Combinations, Combinatorics.var"#10#13"{Combinatorics.var"#reorder#11"{Vector{String}}}}})()
@ Main ./threadingconstructs.jl:52
Is this a multi-threading problem, a problem with the combinatorics package, or a problem between chair and keyboard?
Thank you for your help