Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: all permutations of given lenght

by Eily (Monsignor)
on Aug 11, 2020 at 07:55 UTC ( #11120597=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11120597]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2021-09-24 16:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?