Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Creating tuples based on sets

by shotgunefx (Parson)
on Apr 17, 2003 at 04:46 UTC ( [id://251128]=note: print w/replies, xml ) Need Help??


in reply to Creating tuples based on sets

You could use my code at Non- recursive permutation of arrays. like so.
my @elements = qw(a b c); my $tupler = make_permutator(([@elements]) x 2 ); while (my @tuple = $tupler->() ){ print @tuple,"\n"; }
If a ref return value is wanted, just change "return @els" to "return \@els" in the sub that make_permutator returns.

-Lee

"To be civilized is to deny one's nature."

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (1)
As of 2024-04-19 00:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found