julia> using IterTools
julia> collect(subsets((0,2,6), 2))
ERROR: MethodError: Cannot `convert` an object of type Tuple{Int64,Int64} to an object of type Array{Int64,1}
...
Stacktrace:
[1] setindex!(::Array{Array{Int64,1},1}, ::Tuple{Int64,Int64}, ::Int64) at ./array.jl:767
[2] copyto!(::Array{Array{Int64,1},1}, ::IterTools.Binomial{Tuple{Int64,Int64,Int64}}) at ./abstractarray.jl:671
[3] _collect at ./array.jl:550 [inlined]
[4] collect(::IterTools.Binomial{Tuple{Int64,Int64,Int64}}) at ./array.jl:544
[5] top-level scope at none:0
This works though:
julia> collect(x for x in subsets((0,2,6), 2))
3-element Array{Tuple{Int64,Int64},1}:
(0, 2)
(0, 6)
(2, 6)
Is this a bug in IterTools?
This works though:
Julia 1.1 IterTools 1.3