in reply to Re^2: Challenge: Generate fixed size combination across groups without duplicates
in thread Challenge: Generate fixed size combination across groups without duplicates
I arrived at the same solution:
use Algorithm::Loops; use Math::Combinatorics; my $fixed_size = 2; my @groups = ( [qw( A B C )], [qw( 1 2 3 4 )], [qw( yellow blue green )], [qw( tiny small medium large gigantic )], ); for my $fixed_size_groups ( combine( $fixed_size, @groups ) ) { Algorithm::Loops::NestedLoops $fixed_size_groups, sub { print "@_\n"; }; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Challenge: Generate fixed size combination across groups without duplicates
by ikegami (Patriarch) on Nov 17, 2011 at 10:14 UTC | |
Re^4: Challenge: Generate fixed size combination across groups without duplicates
by Anonymous Monk on Dec 11, 2012 at 11:39 UTC |
In Section
Seekers of Perl Wisdom