JuliaMath / JuliaMath/IntervalSets.jl

Multiple `union` operation is not supported

Open
#103 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
109
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Just like `union([1,2], [2,3], [3,5])`, the following operation should be supported.
```julia
julia> using IntervalSets

julia> union(1..2, 2..3)
1..3

julia> union(1..2, 2..3, 3..5)
ERROR: MethodError: no method matching iterate(::ClosedInterval{Int64})
Closest candidates are:
iterate(::Union{LinRange, StepRangeLen}) at ~/julia/julia-1.7.1/share/julia/base/range.jl:826
iterate(::Union{LinRange, StepRangeLen}, ::Integer) at ~/julia/julia-1.7.1/share/julia/base/range.jl:826
iterate(::T) where T<:Union{Base.KeySet{<:Any, <:Dict}, Base.ValueIterator{<:Dict}} at ~/julia/julia-1.7.1/share/julia/base/dict.jl:695
...
Stacktrace:
[1] mapfilter(pred::Base.var"#115#116"{typeof(∉), typeof(push!), Set{Int64}}, f::typeof(push!), itr::ClosedInterval{Int64}, res::Vector{Int64})
@ Base ./abstractset.jl:443
[2] _grow!
@ ./array.jl:2607 [inlined]
[3] union!(::Vector{Int64}, ::ClosedInterval{Int64}, ::ClosedInterval{Int64}, ::Vararg{ClosedInterval{Int64}})
@ Base ./array.jl:2612
[4] union(::ClosedInterval{Int64}, ::ClosedInterval{Int64}, ::ClosedInterval{Int64})
@ Base ./abstractset.jl:50
[5] top-level scope
@ REPL[3]:1
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.