note
Eily
<p>[mod://Algorithm::Combinatorics] probably has what you want (probably not a permutation though, since it would be the same length as the input, without introducing repetitions). Either variations_with_repetition or combinations_with_repetition should be what you're looking for. The first one considers (A, B, B), (B, A, B), and (B, B, A) to be three different solutions (so produces the three), while the second will only produce (A, B, B) and consider the other two to be identical.</p>
11120593
11120593