]> gitweb.factorcode.org Git - factor.git/commitdiff
math.combinatorics: minor cleanup to next-combination
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 1 Aug 2022 00:30:01 +0000 (17:30 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 1 Aug 2022 00:30:01 +0000 (17:30 -0700)
basis/math/combinatorics/combinatorics.factor

index b1017ef84851320a151c05fbc98723759bf922db..45da55dab87e0c69f3dfc03bd5cf219abb42caa7 100644 (file)
@@ -272,17 +272,17 @@ INSTANCE: combinations immutable-sequence
 : increment-last ( seq -- )
     [ index-of-last [ 1 + ] change-nth-unsafe ] unless-empty ; inline
 
-:: next-combination ( seq n -- seq )
+:: next-combination ( seq n -- )
     seq n find-max-index [
         1 [-] seq increment-rest
     ] [
         seq increment-last
-    ] if* seq ; inline
+    ] if* ; inline
 
 :: combinations-quot ( seq k quot -- seq quot' )
     seq length :> n
     n k nCk <iota> k <iota> >array seq quot n
-    '[ drop _ [ _ nths-unsafe @ ] keep _ next-combination drop ] ; inline
+    '[ drop _ [ _ nths-unsafe @ ] keep _ next-combination ] ; inline
 
 PRIVATE>