Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Multiple Combinatorics

by tobyink (Abbot)
on Apr 15, 2012 at 21:05 UTC ( #965204=note: print w/ replies, xml ) Need Help??


in reply to Multiple Combinatorics

My List::MapMulti module may help.

An example:

use 5.010; use List::MapMulti qw/iterator_multi/; my @letters = 'a' .. 'z'; my @numbers = 0 .. 9; my $iter = iterator_multi \@letters, \@letters, \@letters, \@numbers, +\@numbers; # This loops through every possible combination # of those lists. # while ( my @row = $iter->() ) { say join q(-), @row; }
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re: Multiple Combinatorics
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2014-10-01 23:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (41 votes), past polls