Skip to content

Multiple union operation is not supported #103

Open
@hyrodium

Description

@hyrodium

Just like union([1,2], [2,3], [3,5]), the following operation should be supported.

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

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