Skip to content
Permalink
Browse files

Make sorting a 2 elem list with a mapper stable

Spotted by Nick Wellnhofer++ who also supplied the fix.
  • Loading branch information...
lizmat committed May 29, 2019
1 parent aeba161 commit ab56324da838b4d0ed01e887e3898704ed94ab7e
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/Rakudo/Sorting.pm6
@@ -275,8 +275,8 @@ my class Rakudo::Sorting {
nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',
nqp::if(
nqp::islt_i($n,2)
|| nqp::iseq_i(
mapper(nqp::atpos($O,0)) cmp mapper(nqp::atpos($O,1)),-1),
|| nqp::isle_i(
mapper(nqp::atpos($O,0)) cmp mapper(nqp::atpos($O,1)),0),
$O, # nothing to be done, we already have the result
IB2(nqp::atpos($O,1),nqp::atpos($O,0)) # need to swap
)

0 comments on commit ab56324

Please sign in to comment.
You can’t perform that action at this time.