Combination with repetition
Closed this issue · 1 comments
PhilWaldmann commented
combinations with repetition are currently not supported, right?
Something like that would be awesome!
Combinatorics.combinationWithRep(['a', 'b', 'c'], 4)
/*
=> [
[ 'a', 'a', 'a', 'a' ],
[ 'a', 'a', 'a', 'b' ],
[ 'a', 'a', 'a', 'c' ],
[ 'a', 'a', 'b', 'b' ],
[ 'a', 'a', 'b', 'c' ],
[ 'a', 'a', 'c', 'c' ],
[ 'a', 'b', 'b', 'b' ],
[ 'a', 'b', 'b', 'c' ],
[ 'a', 'b', 'c', 'c' ],
[ 'a', 'c', 'c', 'c' ],
[ 'b', 'b', 'b', 'b' ],
[ 'b', 'b', 'b', 'c' ],
[ 'b', 'b', 'c', 'c' ],
[ 'b', 'c', 'c', 'c' ],
[ 'c', 'c', 'c', 'c' ]
]
*/
blanchg commented
baseN essentially does this, just not in the order you are indicating