Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 lurking in the Monastery: (12)
As of 2015-07-30 18:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls