Skip to content

Commit

Permalink
math.combinatorics: simplify find-combinations
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Dec 8, 2024
1 parent 464e938 commit 2d17c4f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions basis/math/combinatorics/combinatorics.factor
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ PRIVATE>
combinations-with-replacement-quot all? ; inline

: find-combination-with-replacement ( ... seq k quot: ( ... elt -- ... ? ) -- ... elt/f )
[ f ] 3dip '[ nip _ 1check ] combinations-with-replacement-quot find drop and* ; inline
'[ _ keep and ] combinations-with-replacement-quot map-find drop ; inline

: reduce-combinations-with-replacement ( ... seq k identity quot: ( ... prev elt -- ... next ) -- ... result )
-rotd each-combination-with-replacement ; inline
Expand Down Expand Up @@ -307,7 +307,7 @@ PRIVATE>
combinations-quot all? ; inline

: find-combination ( ... seq k quot: ( ... elt -- ... ? ) -- ... elt/f )
[ f ] 3dip '[ nip _ 1check ] combinations-quot find drop and* ; inline
'[ _ keep and ] combinations-quot map-find drop ; inline

: reduce-combinations ( ... seq k identity quot: ( ... prev elt -- ... next ) -- ... result )
-rotd each-combination ; inline
Expand Down

0 comments on commit 2d17c4f

Please sign in to comment.