Meaning of `isless`, `<`, `cmp`, `isequal`, `==`, total order, partial order, unordered

Sorry for my wrong wording and the error in the code snippet.
By elementwise, I meant: A < B <=> for all i: a[i] < b[i].

why not? That is the standard partial order for functions. Array may be considered as a function that is mapping its index set to its values.

In a narrow set of contexts, this comparison could useful for arrays, but in the standard library I don’t think it is useful to define a < function in which most arguments are unordered.

1 Like

True. That is the same argument, which let me dislike to define isless for arrays in general (even vectors).

1 Like

There is another argument: If we define isless/cmp for AbstractArray that will be usable for all subtypes. Many of them would cry for specialized implementations for performance reasons. The current list:

julia> subtypes(AbstractArray)
29-element Array{Union{DataType, UnionAll},1}:
 AbstractRange                      
 AbstractSparseArray                
 Adjoint                            
 Base.LinAlg.AbstractQ              
 Base.LinAlg.AbstractTriangular     
 Base.LinAlg.HessenbergQ            
 Base.LinAlg.LQPackedQ              
 Base.LogicalIndex                  
 Base.ReinterpretArray              
 Base.ReshapedArray                 
 Bidiagonal                         
 CartesianIndices                   
 ConjArray                          
 Core.Inference.AbstractRange       
 DenseArray                         
 Diagonal                           
 Hermitian                          
 IterativeEigensolvers.AtA_or_AAt   
 IterativeEigensolvers.SVDAugmented 
 LinearIndices                      
 PermutedDimsArray                  
 RowVector                          
 SubArray                           
 SuiteSparse.CHOLMOD.FactorComponent
 SymTridiagonal                     
 Symmetric                          
 Test.GenericArray                  
 Transpose                          
 Tridiagonal                        

julia>