Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: cross combinations

by chas (Priest)
on Oct 29, 2005 at 06:31 UTC ( #503831=note: print w/replies, xml ) Need Help??

in reply to cross combinations

Just a remark: It has been discussed on PM in the past that the glob function will do most of the work in forming a cartesian product (I don't remember exactly where, though...) So, for example,
@a=map {split //} glob "{1,2}{3,4}"; while(@a){$x=shift @a;$y=shift @a;print "{$x,$y} "};
and you can clearly write functions like "cross" by formatting the output to taste.
(Not that this is more efficient than other solutions presented...probably isn't.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://503831]
[Discipulus]: oh and dont miss my last poetry!
[marioroy]: Hello all. After several attempts, am able to move forward and will soon release a Parallel:: ForkManager compatible MCE::Hobo:: Manager, also MCE::Hobo::Simple, and refactored MCE::Hobo engine supporting multiple instances. Wait works beautifully.
[marioroy]: MCE::Shared has been refined that it allows sharing Tie::File and hash objects containing {fh} key.

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2017-05-26 08:22 GMT
Find Nodes?
    Voting Booth?