Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: finding all combinations

by BrowserUk (Pope)
on Jan 14, 2008 at 01:50 UTC ( #662240=note: print w/replies, xml ) Need Help??


in reply to finding all combinations

Just because it uses List::Comprehensions which I recently discovered and absolutely love:

use List::Comprehensions;; comp1 { print join '-', @_ } [1,2,3], [7,8], [1,5,23,3];; 1-7-1 1-7-5 1-7-23 1-7-3 1-8-1 1-8-5 1-8-23 1-8-3 2-7-1 2-7-5 2-7-23 2-7-3 2-8-1 2-8-5 2-8-23 2-8-3 3-7-1 3-7-5 3-7-23 3-7-3 3-8-1 3-8-5 3-8-23 3-8-3

Or if you prefer:

comp1 { print join '-', reverse @_ } [1,5,23,3], [7,8], [1,2,3];; 1-7-1 2-7-1 3-7-1 1-8-1 2-8-1 3-8-1 1-7-5 2-7-5 3-7-5 1-8-5 2-8-5 3-8-5 1-7-23 2-7-23 3-7-23 1-8-23 2-8-23 3-8-23 1-7-3 2-7-3 3-7-3 1-8-3 2-8-3 3-8-3

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2018-11-17 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (205 votes). Check out past polls.

    Notices?