General

Profile

bkDJ (Djilani Kebaili)

  • Login: bkDJ
  • Registered on: 01/30/2024
  • Last sign in: 09/04/2024

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 0 0 0

Activity

01/30/2024

10:15 AM Ruby Bug #20226: Inconsistent Sort results on 3.3.0 compared to previous versions
You can force stability by using the original index as a tiebreaker.
```ruby
arr = [*Array.new(15,1), -0.02, 0.02]
puts "Unstable: #{arr.sort_by(&:abs)[0..1]}"
puts "Stable: #{arr.sort_by.with_index { [_1.abs, _2] }[0..1]}"
```
bkDJ (Djilani Kebaili)

Also available in: Atom