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

Multiple union operation is not supported #103

Open
hyrodium opened this issue Apr 9, 2022 · 0 comments
Open

Multiple union operation is not supported #103

hyrodium opened this issue Apr 9, 2022 · 0 comments

Comments

@hyrodium
Copy link
Collaborator

hyrodium commented Apr 9, 2022

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
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