Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's -- permutations

by choroba (Cardinal)
on Sep 18, 2020 at 09:12 UTC ( [id://11121904]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's -- permutations
in thread Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's

It returns far more results than needed, as they are repeated, because for permutations, zero at position 0 is different to zero at position 1.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
  • Comment on Re^3: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's -- permutations
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-24 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found