]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/math/combinatorics/combinatorics.factor
sequences: add index-of-last
[factor.git] / basis / math / combinatorics / combinatorics.factor
index 0b8713cc6b055678648a431378ec0834d148cdb6..ed3af83d7cf5ad3467c7f3436cb5a089139c965a 100644 (file)
@@ -270,7 +270,7 @@ INSTANCE: combinations immutable-sequence
     [ drop 1 + dup ] map! 2drop ; inline
 
 : increment-last ( seq -- )
-    [ [ length 1 - ] keep [ 1 + ] change-nth-unsafe ] unless-empty ; inline
+    [ index-of-last [ 1 + ] change-nth-unsafe ] unless-empty ; inline
 
 :: next-combination ( seq n -- seq )
     seq n find-max-index [