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

bug in intersect #210

Open
ericphanson opened this issue Jan 6, 2023 · 3 comments
Open

bug in intersect #210

ericphanson opened this issue Jan 6, 2023 · 3 comments
Milestone

Comments

@ericphanson
Copy link
Contributor

julia> using Intervals

julia> intersect([Interval{Int, Closed, Open}(1,3), Interval{Int, Closed, Open}(3,5)])
1-element Vector{Interval{Int64, Closed, Open}}:
 Interval{Int64, Closed, Open}(1, 5)

Those two intervals don't have any common elements, so they don't intersect.

@iamed2
Copy link
Member

iamed2 commented Jan 10, 2023

That call doesn't actually take the intersection of the two intervals.

To do that:

julia> intersect(Interval{Int, Closed, Open}(1,3), Interval{Int, Closed, Open}(3,5))
Interval{Int64, Open, Open}(0, 0)

Intersect of one argument is an identity operation. For some reason Julia dispatches intersect(s) = union(s), so the misleading union method on arrays of intervals that is currently deprecated takes over. Once that deprecated method is removed, this call will return an array containing the same intervals in the same order.

@ericphanson
Copy link
Contributor Author

Oh! Ok. That's pretty confusing. Can we do a breaking release & drop the deprecation?

@iamed2
Copy link
Member

iamed2 commented Jan 10, 2023

Seems reasonable, although it might be good to address any invalidations that still exist at the same time.

@rofinn rofinn added this to the Intervals 2.0 milestone Apr 4, 2023
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

3 participants