Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
"be consistent"
 
PerlMonks  

Re: cross combinations

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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.)
chas

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://503831]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.