Set::Partition

Set::Partition is a Perl module that can enumerate all arrangements of a set in fixed subsets.
Download

Set::Partition Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • David Landgren
  • Publisher web site:
  • http://search.cpan.org/~dland/

Set::Partition Tags


Set::Partition Description

Set::Partition is a Perl module that can enumerate all arrangements of a set in fixed subsets. Set::Partition is a Perl module that can enumerate all arrangements of a set in fixed subsets.SYNOPSIS use Set::Partition; my $s = Set::Partition->new( list => , partition => , ); while (my $p = $s->next) { print join( ' ', map { "(@$_)" } @$p ), $/; } # produces (a b) (c d e) (a c) (b d e) (a d) (b c e) (a e) (b c d) (b c) (a d e) (b d) (a c e) (b e) (a c d) (c d) (a b e) (c e) (a b d) (d e) (a b c) # or with a hash my $s = Set::Partition->new( list => { b => 'bat', c => 'cat', d => 'dog' }, partition => , ); while (my $p = $s->next) { ... }Set::Partition takes a list or hash of elements and a list numbers that represent the sizes of the partitions into which the list of elements should be arranged.The resulting object can then be used as an iterator which returns a reference to an array of lists, that represents the original list arranged according to the given partitioning. All possible arrangements are returned, and the object returns undef when the entire combination space has been exhausted. Requirements: · Perl


Set::Partition Related Software