abbypan / List-Permutor-Repeat

Process all possible repeat permutations of a list,组合数学,可重复排列

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NAME

List::Permutor::Repeat - Process all possible repeat permutations of a list

组合数学,可重复排列

SYNOPSIS

use List::Permutor::Repeat;
my $perm = new List::Permutor::Repeat qw/ a b /;
while (my @set = $perm->next) {
    print @set, "\n";
}

#aa
#ab
#ba
#bb
 

DESCRIPTION

This is repeat permutation.

Not repeat elem permutation see Tom Phoenix's List::Permutor.

METHODS

new LIST

初始化,传入一个数组

Returns a permutor for the given items.

next

取出下一个可重复的排列

Returns a list of the items in the next permutation.

for example, the repeat permutations of (1..5) first: (1, 1, 1, 1, 1) last: (5, 5, 5, 5, 5)

peek

取回当前的排列

Returns the list of items which would be returned by next()

reset

重置排列,从头开始

Resets the iterator to the start.

AUTHOR

Abby Pan <abbypan@gmail.com>

The object oriented interface/method is taken from Tom Phoenix's List::Permutor.

About

Process all possible repeat permutations of a list,组合数学,可重复排列

License:MIT License


Languages

Language:Perl 100.0%