David Landgren > Integer-Partition-0.01 > Integer::Partition

Download:
Integer-Partition-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.01   Source   Latest Release: Integer-Partition-0.03

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 ^

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.