Does this happen to any of you too?
Do you have any idea why?
sortperm(rand(1:10,10)) # ok
sortperm(rand(1:10,10^2)) # ok
sortperm(rand(1:10,10^7)) # ok
sortperm(rand(1:10,10), lt= >=) #ok
sortperm(rand(1:10,10^2), lt= >=) #ok or sometime crashes language server
sortperm(rand(1:10,10^3), lt= >=) # crashes language server
what i get sometimes using Julia directly not in vscode
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.8.3 (2022-11-14)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> sortperm(rand(1:10,10^3), lt= >=)
ERROR: BoundsError: attempt to access 1000-element Vector{Int64} at index [-5]
Stacktrace:
[1] getindex
@ .\array.jl:924 [inlined]
[2] partition!(v::Vector{Int64}, lo::Int64, hi::Int64, o::Base.Order.Perm{Base.Order.Lt{Base.Order.var"#1#3"{typeof(>=), typeof(identity)}}, Vector{Int64}})
@ Base.Sort .\sort.jl:561
[3] sort!(v::Vector{Int64}, lo::Int64, hi::Int64, a::Base.Sort.QuickSortAlg, o::Base.Order.Perm{Base.Order.Lt{Base.Order.var"#1#3"{typeof(>=), typeof(identity)}}, Vector{Int64}})
@ Base.Sort .\sort.jl:572
[4] sort!(v::Vector{Int64}, lo::Int64, hi::Int64, a::Base.Sort.QuickSortAlg, o::Base.Order.Perm{Base.Order.Lt{Base.Order.var"#1#3"{typeof(>=), typeof(identity)}}, Vector{Int64}}) (repeats 2 times)
@ Base.Sort .\sort.jl:577
[5] sort!(v::Vector{Int64}, alg::Base.Sort.QuickSortAlg, order::Base.Order.Perm{Base.Order.Lt{Base.Order.var"#1#3"{typeof(>=), typeof(identity)}}, Vector{Int64}})
@ Base.Sort .\sort.jl:661
[6] sortperm(v::Vector{Int64}; alg::Base.Sort.QuickSortAlg, lt::Function, by::Function, rev::Nothing, order::Base.Order.ForwardOrdering)
@ Base.Sort .\sort.jl:927
[7] top-level scope
@ REPL[1]:1
julia>