Right now, this is the error message we get when trying to compute the union of incompatible intervals:
julia> OpenInterval(1, 2) ∪ OpenInterval(2, 3)
ERROR: ArgumentError: Cannot construct union of disjoint sets.
It is a little bit confusing since it is possible to construct the union of disjoint intervals as long as they share an endpoint:
julia> isdisjoint(OpenInterval(1, 2), OpenInterval(2, 3))
true
julia> OpenInterval(1, 2) ∪ ClosedInterval(2, 3)
1 .. 3 (open-closed)
The confusion arises from such a pair of intervals being disjoint but connected sets. Maybe the error message should be changed to reflect that. Also, right now, in order to check if two intervals are disconnected, you have to do something like
isdisjoint(A, B) && !=(endpoints(A ∩ B)...)
which is a little bit inefficient since it computes A ∩ B twice or go full-on with
AB = A ∩ B
isempty(AB) && !=(endpoints(AB)...)
which is kind of lengthy. Maybe it would make sense to have a isconnected method?
All in all fairly minor issue, but it got me a little bit confused as a first-time user.
Right now, this is the error message we get when trying to compute the union of incompatible intervals:
It is a little bit confusing since it is possible to construct the union of disjoint intervals as long as they share an endpoint:
The confusion arises from such a pair of intervals being disjoint but connected sets. Maybe the error message should be changed to reflect that. Also, right now, in order to check if two intervals are disconnected, you have to do something like
which is a little bit inefficient since it computes
A ∩ Btwice or go full-on withwhich is kind of lengthy. Maybe it would make sense to have a
isconnectedmethod?All in all fairly minor issue, but it got me a little bit confused as a first-time user.