diff --git a/basis/math/combinatorics/combinatorics.factor b/basis/math/combinatorics/combinatorics.factor index e091b18329..baa401cd71 100644 --- a/basis/math/combinatorics/combinatorics.factor +++ b/basis/math/combinatorics/combinatorics.factor @@ -253,9 +253,9 @@ PRIVATE> :: next-selection ( seq n -- ) 1 seq length 1 - [ - over 0 = + dup 0 >= [ over 0 = ] [ t ] if ] [ - [ seq [ + n /mod ] change-nth-unsafe ] keep 1 - + [ seq [ + n /mod ] change-nth ] keep 1 - ] do until 2drop ; inline :: (selections) ( seq n -- selections )