Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Creating tuples based on sets

by shotgunefx (Parson)
on Apr 17, 2003 at 04:46 UTC ( #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
Node Status?
node history
Node Type: note [id://251128]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2021-03-04 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (105 votes). Check out past polls.

    Notices?