| List-Permutor-LOL documentation | view source | Contained in the List-Permutor-LOL distribution. |
List::Permutor::LOL - Permute lists inside a list
my $list = [[qw(a b)],[qw(c d)]];
my $p = List::Permutor::LOL->new($list);
while(my $r = $p->next) {
# ...
}
This module accepts an arrayref of arrayref, and behaves as a global permutor like List::Permutor. The top-level list ordering is however, unchanged. For example, This lol has 4 permutations:
[[qw(a b)],[qw(c d)]]
And that would be:
[[qw(a b)],[qw(c d)]] [[qw(b a)],[qw(c d)]] [[qw(a b)],[qw(d c)]] [[qw(b a)],[qw(d c)]]
And this list would have only 1 permutation (itself):
[['a'] , ['b']]
If you pass a list container non-arraryrefs, it will be keep un touched, so this list would have 2 permutations:
[[qw(a b)],'c']
And that would be:
[[qw(a b)],'c'] [[qw(b a)],'c']
Returns a permutor for the given list-of-lists
Returns a list of the items in the next permutation.
Returns the list of items which would be returned by next(), but doesn't advance the sequenc.
Resets the iterator to the start. May be used at any time, whether the entire set has been produced or not. Has no useful return value.
Copyright 2004 by Kang-min Liu <gugod@gugod.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>
| List-Permutor-LOL documentation | view source | Contained in the List-Permutor-LOL distribution. |