File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ import {_take} from '@iterable-iterator/slice';
33
44import { list } from '@iterable-iterator/list' ;
55import { pick } from '@iterable-iterator/map' ;
6- import { range } from '@iterable-iterator/range' ;
6+ import {
7+ forwardRangeIterator ,
8+ backwardRangeIterator ,
9+ } from '@iterable-iterator/range' ;
710
811/**
912 * Yields all permutations of each possible choice of <code>r</code> elements
@@ -31,8 +34,8 @@ export default function* permutations(iterable, r) {
3134 return ;
3235 }
3336
34- const indices = list ( range ( 0 , length , 1 ) ) ;
35- const cycles = list ( range ( length , length - r , - 1 ) ) ;
37+ const indices = list ( forwardRangeIterator ( 0 , length , 1 ) ) ;
38+ const cycles = list ( backwardRangeIterator ( length , length - r , - 1 ) ) ;
3639
3740 yield list ( pick ( pool , _take ( indices , r ) ) ) ;
3841
You can’t perform that action at this time.
0 commit comments