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';
3
3
4
4
import { list } from '@iterable-iterator/list' ;
5
5
import { pick } from '@iterable-iterator/map' ;
6
- import { range } from '@iterable-iterator/range' ;
6
+ import {
7
+ forwardRangeIterator ,
8
+ backwardRangeIterator ,
9
+ } from '@iterable-iterator/range' ;
7
10
8
11
/**
9
12
* Yields all permutations of each possible choice of <code>r</code> elements
@@ -31,8 +34,8 @@ export default function* permutations(iterable, r) {
31
34
return ;
32
35
}
33
36
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 ) ) ;
36
39
37
40
yield list ( pick ( pool , _take ( indices , r ) ) ) ;
38
41
You can’t perform that action at this time.
0 commit comments