Open
Description
opened on Mar 6, 2023
According to the documentation for isless
,
If
isless(x, y)
is defined, then so isisless(y, x)
andisequal(x, y)
, and exactly one of those three yields true.
My understanding is that this should hold for all possible arguments. However, on 1.9.0-beta4 and master,
julia> using OffsetArrays
julia> x = [1,2,3]; y = OffsetVector(x, -1);
julia> (isless(x,y), isless(y,x), isequal(x,y))
(false, false, false)
This is because isequal(x,y)
gives false
if x
and y
have different index ranges. This is also inconsistent with cmp
,
julia> cmp(x,y)
0
since according to the documentation cmp(x,y) == 0
should imply isequal(x,y)
.
Would it be a solution to define isless(x,y)
and cmp(x,y)
for AbstractVector
only if firstindex(x) == firstindex(y)
and to raise an error otherwise? Or would that be breaking?
Activity