NAME
Integer::Partition - Generate all integer partitions of an integer
VERSION
This document describes version 0.01 of Integer::Partition, released 2007-xx-xx.
SYNOPSIS
use Integer::Partition;
my $i = Integer::Partition->new(4);
while (my $p = $i->next) {
print join( ' ', map { "(@$_)" } @$p ), $/;
}
# produces
4
3 1
2 2
2 1 1
1 1 1 1
DESCRIPTION
Integer::Partition
takes an integer number and produces an object that can be used to generate all possible integer partitions of the original number in reverse lexographic order.
METHODS
- new
-
Creates a new
Integer::Partition
object. Takes an integer as a parameter. - next
-
Returns the partition, or
undef
when all partitions have been generated. - reset
-
Resets the object, which causes it to enumerate the arrangements from the beginning.
$p->reset; # begin again
DIAGNOSTICS
None.
NOTES
None.
SEE ALSO
Permutations, combinations, derangements and more; all you need for your set transformations.
BUGS
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 $Integer::Partition::VERSION'
perl -V
ACKNOWLEDGEMENTS
TODO
AUTHOR
David Landgren, copyright (C) 2007. All rights reserved.
http://www.landgren.net/perl/
If you (find a) use this module, I'd 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?
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.