File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -127,3 +127,9 @@ tools.test ;
127127{ 1 } [ 11 13 stein ] unit-test
128128{ 2 } [ 14 52 stein ] unit-test
129129{ 7 } [ 14 7 stein ] unit-test
130+
131+ { { { 2 3 4 } { 1 3 4 } { 1 2 4 } { 1 2 3 } } } [ 1 { 1 2 3 4 } all-removals ] unit-test
132+ { { { 3 4 } { 2 4 } { 2 3 } { 1 4 } { 1 3 } { 1 2 } } } [ 2 { 1 2 3 4 } all-removals ] unit-test
133+ { { { 4 } { 3 } { 2 } { 1 } } } [ 3 { 1 2 3 4 } all-removals ] unit-test
134+ { { { } } } [ 4 { 1 2 3 4 } all-removals ] unit-test
135+ { { } } [ 5 { 1 2 3 4 } all-removals ] unit-test
Original file line number Diff line number Diff line change @@ -410,3 +410,6 @@ M:: vose random* ( obj rnd -- elt )
410410 dup obj probs>> nth-unsafe { float } declare rnd random-unit* >=
411411 [ obj alias>> nth-unsafe { fixnum } declare ] unless
412412 obj items>> nth-unsafe ;
413+
414+ :: all-removals ( n seq -- seqs )
415+ seq length <iota> n over '[ _ swap diff seq nths ] map-combinations ;
You can’t perform that action at this time.
0 commit comments