873873# # generic sorting methods ##
874874
875875defalg (v:: AbstractArray ) = DEFAULT_STABLE
876- defalg (v:: AbstractArray{<:Union{Number, Missing}} ) = DEFAULT_UNSTABLE
877- defalg (v:: AbstractArray{Missing} ) = DEFAULT_UNSTABLE # for method disambiguation
878- defalg (v:: AbstractArray{Union{}} ) = DEFAULT_UNSTABLE # for method disambiguation
879876
880877function sort! (v:: AbstractVector{T} , alg:: Algorithm ,
881878 order:: Ordering , t:: Union{AbstractVector{T}, Nothing} = nothing ) where T
@@ -890,15 +887,15 @@ end
890887"""
891888 sort!(v; alg::Algorithm=defalg(v), lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)
892889
893- Sort the vector `v` in place. [`QuickSort`](@ref) is used by default for numeric arrays while
894- [`MergeSort`](@ref) is used for other arrays. You can specify an algorithm to use via the `alg`
895- keyword (see [Sorting Algorithms](@ref) for available algorithms). The `by` keyword lets you provide
896- a function that will be applied to each element before comparison; the `lt` keyword allows
897- providing a custom "less than" function (note that for every `x` and `y`, only one of `lt(x,y)`
898- and `lt(y,x)` can return ` true`); use `rev=true` to reverse the sorting order. These
899- options are independent and can be used together in all possible combinations: if both `by`
900- and `lt` are specified, the `lt` function is applied to the result of the `by` function;
901- `rev=true` reverses whatever ordering specified via the `by` and `lt` keywords.
890+ Sort the vector `v` in place. A stable algorithm is used by default. You can select a
891+ specific algorithm to use via the `alg` keyword (see [Sorting Algorithms](@ref) for
892+ available algorithms). The `by` keyword lets you provide a function that will be applied to
893+ each element before comparison; the `lt` keyword allows providing a custom "less than"
894+ function (note that for every `x` and `y`, only one of `lt(x,y)` and `lt(y,x)` can return
895+ ` true`); use `rev=true` to reverse the sorting order. These options are independent and can
896+ be used together in all possible combinations: if both `by` and `lt` are specified, the `lt `
897+ function is applied to the result of the `by` function; `rev=true` reverses whatever
898+ ordering specified via the `by` and `lt` keywords.
902899
903900# Examples
904901```jldoctest
@@ -1241,7 +1238,7 @@ end
12411238# # sorting multi-dimensional arrays ##
12421239
12431240"""
1244- sort(A; dims::Integer, alg::Algorithm=DEFAULT_UNSTABLE , lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)
1241+ sort(A; dims::Integer, alg::Algorithm=defalg(A) , lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)
12451242
12461243Sort a multidimensional array `A` along the given dimension.
12471244See [`sort!`](@ref) for a description of possible
@@ -1269,7 +1266,7 @@ julia> sort(A, dims = 2)
12691266"""
12701267function sort (A:: AbstractArray{T} ;
12711268 dims:: Integer ,
1272- alg:: Algorithm = DEFAULT_UNSTABLE ,
1269+ alg:: Algorithm = defalg (A) ,
12731270 lt= isless,
12741271 by= identity,
12751272 rev:: Union{Bool,Nothing} = nothing ,
0 commit comments