Closed
Description
Following issue #26741 I have another problem with sort
when using order
argument. Consider the following inconsistency as an example (similar thing is present with lt
):
julia> sort([1,-1,2], by=identity, order=Base.By(abs))
3-element Array{Int64,1}:
1
-1
2
julia> sort([1,-1,2], by=x->-x, order=Base.By(abs))
3-element Array{Int64,1}:
2
1
-1
In the first case, following the implementation in ordering.jl, Julia ignores by
argument in the first case, because it is equal to the default and in the second case it respects it.
In general order
argument is not documented well and it defaults to a non-exported value.
I am not sure, given we are in 0.7.0-alpha stage if this should be:
- fixed (e.g. by not exposing
order
argument in public API)
or - only documented precisely describing the way it works (or at least saying to either use
lt
,by
andrev
ororder
keyword argument)?