List::Permutor::LOL - Permute lists inside a list


List-Permutor-LOL documentation  | view source Contained in the List-Permutor-LOL distribution.

Index


NAME

Top

List::Permutor::LOL - Permute lists inside a list

SYNOPSIS

Top

  my $list = [[qw(a b)],[qw(c d)]];
  my $p = List::Permutor::LOL->new($list);

  while(my $r = $p->next) {
    # ...
  }

DESCRIPTION

Top

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']

METHODS

Top

new(arrayref of arrayref)

Returns a permutor for the given list-of-lists

next

Returns a list of the items in the next permutation.

peak

Returns the list of items which would be returned by next(), but doesn't advance the sequenc.

reset

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.

SEE ALSO

Top

List::Permutor, Algorithm::Permute

COPYRIGHT

Top


List-Permutor-LOL documentation  | view source Contained in the List-Permutor-LOL distribution.