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

Re^2: dynamic map "quadrant" indexing

by ikegami (Pope)
on Aug 14, 2005 at 17:07 UTC ( #483709=note: print w/replies, xml ) Need Help??


in reply to Re: dynamic map "quadrant" indexing
in thread dynamic map "quadrant" indexing

Or with Algorithm::Loops:
use Algorithm::Loops qw( NestedLoops ); my $level = 3; my @indices = NestedLoops( [ (['A'..'D']) x $level ], sub { join '', map { "${_}1" } @_ } ); foreach my $val (@indices) { print($val\n") ]
or as an interator:
use Algorithm::Loops qw( NestedLoops ); my $level = 3; my $iter = NestedLoops( [ (['A'..'D']) x $level ] ); while (my @values = $iter->()) { my $val = join '', map { "${_}1" } @values; print("$val\n"); }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2020-05-26 13:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (150 votes). Check out past polls.

    Notices?