http://qs321.pair.com?node_id=11120597


in reply to all permutations of given lenght

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.

Replies are listed 'Best First'.
Re^2: all permutations of given lenght
by cataclismic_user (Novice) on Aug 11, 2020 at 08:23 UTC
    Many thanks! variations_with_repetitions has done the job nicely!