We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting by multiple columns using usual (non-natural) sorting works:
sort([["a1", "a2"], ["a10", "a5"], ["a7", "a11"], ["a1", "a11"]], by = cols -> (cols[1], cols[2]))
and returns (sorted but not naturally):
4-element Array{Array{String,1},1}: ["a1", "a11"] ["a1", "a2"] ["a10", "a5"] ["a7", "a11"]
However, the same doesn't work for lt=natural
lt=natural
julia> using NaturalSort julia> sort([["a1", "a2"], ["a10", "a5"], ["a7", "a11"], ["a1", "a11"]], by = cols -> (cols[1], cols[2]), lt=natural) ERROR: MethodError: no method matching natural(::Tuple{String,String}, ::Tuple{String,String}) Stacktrace: [1] (::Base.Order.var"#1#2"{typeof(natural),var"#21#22"})(::Array{String,1}, ::Array{String,1}) at ./ordering.jl:70 [2] lt(::Base.Order.Lt{Base.Order.var"#1#2"{typeof(natural),var"#21#22"}}, ::Array{String,1}, ::Array{String,1}) at ./ordering.jl:53 [3] sort! at ./sort.jl:480 [inlined] [4] sort!(::Array{Array{String,1},1}, ::Int64, ::Int64, ::Base.Sort.MergeSortAlg, ::Base.Order.Lt{Base.Order.var"#1#2"{typeof(natural),var"#21#22"}}, ::Array{Array{String,1},1}) at ./sort.jl:565 [5] sort! at ./sort.jl:564 [inlined] [6] sort! at ./sort.jl:655 [inlined] [7] #sort!#7 at ./sort.jl:715 [inlined] [8] #sort#8 at ./sort.jl:763 [inlined] [9] top-level scope at REPL[15]:1
though it works with single argument (non-tuple) by function:
by
julia> sort([["a1", "a2"], ["a10", "a5"], ["a7", "a11"], ["a1", "a11"]], by = cols -> cols[2], lt=natural) 4-element Array{Array{String,1},1}: ["a1", "a2"] ["a10", "a5"] ["a7", "a11"] ["a1", "a11"] julia> sort([["a1", "a2"], ["a10", "a5"], ["a7", "a11"], ["a1", "a11"]], by = cols -> cols[1], lt=natural) 4-element Array{Array{String,1},1}: ["a1", "a2"] ["a1", "a11"] ["a7", "a11"] ["a10", "a5"]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Sorting by multiple columns using usual (non-natural) sorting works:
and returns (sorted but not naturally):
However, the same doesn't work for
lt=natural
though it works with single argument (non-tuple)
by
function:The text was updated successfully, but these errors were encountered: