Creates a new Set::Partition object. A set of key/value parameters
can be supplied to control the finer details of the objects
<B>partitionB>, the list of integers representing the size of the partitions used to arrange the set. The sum should be equal to the number of elements given by <B>listB>. If it less than the number of elements, a dummy partition will be added to equalise the count. This partition will be returned during iteration. If the sum is greater than the number of elements, new() will croak with a fatal error.
|next||Returns the next arrangement of subsets, or undef when all arrangements have been enumerated.|
Resets the object, which causes it to enumerate the arrangements from the
A list of partition sizes (for instance, 2, 3, 4) was given, along with a list to partition (for instance, containing 8 elements), however, the number of elements required to fill the different partitions (9) exceeds the number available in the source list (8).
The order within a set is unimportant, thus, if
(a b) (c d)
is produced, then the following arrangement will never be encountered:
(a b) (d c)
On the other hand, the order of the sets is important, which means that the following arrangement will be encountered:
(c d) (a b)
Algorithm::Combinatorics Permutations, combinations, derangements and more; all you need for your set transformations.
Using a partition of length 0 is valid, although you get back an undef, rather than an empty array. This could be construed as a bug.
Please report all bugs at <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Set-Partition|rt.cpan.org>
Make sure you include the output from the following two commands:
perl -MSet::Partition -le print Set::Partition::VERSION perl -V
Ken Williams suggested the possibility to use a hash as a source for partitioning.
David Landgren, copyright (C) 2006. All rights reserved.
If you (find a) use this module, Id love to hear about it. If you want to be informed of updates, send me a note. You know my first name, you know my domain. Can you guess my e-mail address?
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||PARTITION (3)||2006-10-11|