r1555 - in packages/libmath-combinatorics-perl/trunk: . debian
lib/Math t
Carlo Segre
segre-guest at costa.debian.org
Thu Dec 1 17:03:47 UTC 2005
Author: segre-guest
Date: 2005-12-01 17:03:47 +0000 (Thu, 01 Dec 2005)
New Revision: 1555
Added:
packages/libmath-combinatorics-perl/trunk/t/02.t
packages/libmath-combinatorics-perl/trunk/t/03.t
Modified:
packages/libmath-combinatorics-perl/trunk/MANIFEST
packages/libmath-combinatorics-perl/trunk/META.yml
packages/libmath-combinatorics-perl/trunk/debian/changelog
packages/libmath-combinatorics-perl/trunk/lib/Math/Combinatorics.pm
packages/libmath-combinatorics-perl/trunk/t/01.t
Log:
new upstream
Modified: packages/libmath-combinatorics-perl/trunk/MANIFEST
===================================================================
--- packages/libmath-combinatorics-perl/trunk/MANIFEST 2005-12-01 17:01:07 UTC (rev 1554)
+++ packages/libmath-combinatorics-perl/trunk/MANIFEST 2005-12-01 17:03:47 UTC (rev 1555)
@@ -4,4 +4,6 @@
README
lib/Math/Combinatorics.pm
t/01.t
+t/02.t
+t/03.t
META.yml Module meta-data (added by MakeMaker)
Modified: packages/libmath-combinatorics-perl/trunk/META.yml
===================================================================
--- packages/libmath-combinatorics-perl/trunk/META.yml 2005-12-01 17:01:07 UTC (rev 1554)
+++ packages/libmath-combinatorics-perl/trunk/META.yml 2005-12-01 17:03:47 UTC (rev 1555)
@@ -1,10 +1,10 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Math-Combinatorics
-version: 0.07
+version: 0.08
version_from: lib/Math/Combinatorics.pm
installdirs: site
requires:
distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+generated_by: ExtUtils::MakeMaker version 6.17
Modified: packages/libmath-combinatorics-perl/trunk/debian/changelog
===================================================================
--- packages/libmath-combinatorics-perl/trunk/debian/changelog 2005-12-01 17:01:07 UTC (rev 1554)
+++ packages/libmath-combinatorics-perl/trunk/debian/changelog 2005-12-01 17:03:47 UTC (rev 1555)
@@ -1,3 +1,9 @@
+libmath-combinatorics-perl (0.08-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Carlo Segre <segre at iit.edu> Thu, 1 Dec 2005 12:01:19 -0600
+
libmath-combinatorics-perl (0.07-1) unstable; urgency=low
* New upstream release
Modified: packages/libmath-combinatorics-perl/trunk/lib/Math/Combinatorics.pm
===================================================================
--- packages/libmath-combinatorics-perl/trunk/lib/Math/Combinatorics.pm 2005-12-01 17:01:07 UTC (rev 1554)
+++ packages/libmath-combinatorics-perl/trunk/lib/Math/Combinatorics.pm 2005-12-01 17:03:47 UTC (rev 1555)
@@ -113,7 +113,7 @@
$o = Math::Combinatorics->new( count=>3 , data=>[qw(. -)] , frequency=>[3,3] );
while ( my @x = $o->next_multiset ) {
- my $p = Math::Combinatorics->new( data=>\@x );
+ my $p = Math::Combinatorics->new( data=>\@x , frequency=>[map{1} @x] );
while ( my @y = $p->next_string ) {
#do something
}
@@ -155,12 +155,14 @@
=head1 ACKNOWLEDGEMENTS
-Thanks to everyone for helping to make this a better module.
+A sincere thanks to everyone for helping to make this a better module. After initial
+development I've only had time to accept patches and improvements. Math::Combinatorics
+continues to be developed and improved by the community. Contributors of note include:
-For adding new features: Carlos Rica, David Coppit, Carlos Segre
+For adding new features: Carlos Rica, David Coppit, Carlos Segre, Lyon Lemmens
For bug reports: Ying Yang, Joerg Beyer, Marc Logghe, Yunheng Wang,
-Torsten Seemann, Gerrit Haase, Joern Behre
+Torsten Seemann, Gerrit Haase, Joern Behre, Lyon Lemmens, Federico Lucifredi
=head1 BUGS / TODO
@@ -204,7 +206,7 @@
our @ISA = qw(Exporter);
our @EXPORT = qw( combine derange factorial permute );
-our $VERSION = '0.07';
+our $VERSION = '0.08';
=head1 EXPORTED FUNCTIONS
@@ -407,13 +409,15 @@
#appropriate for object elements, perhaps
compare => sub { $_[0]->value <=> $_[1]->value }
- defaults to "sub { $_[0] cmp $_[1] }"
+ The default sort mechanism is based on references, and cannot be predicted.
+ Improvements for a more flexible compare() mechanism are most welcome.
=cut
sub new {
my($class,%arg) = @_;
my $self = bless {}, $class;
+
$self->{compare} = $arg{compare} || sub { $_[0] cmp $_[1] };
$self->{count} = $arg{count};
@@ -442,10 +446,21 @@
#warn join ' ', @{$arg{data}};
+ #OK, this is hokey, but I don't have time to fix it properly right now.
+ #We want to allow both user-specified sorting as well as our own
+ #reference-based internal sorting -- the latter only because unit tests
+ #are failing if we don't have it. Additionally, we don't want to require
+ #the triple derefernce necessary for comparison of the pristine data in
+ #the user-supplied compare coderef. The solution for now is to do an
+ #if/else. If you're staring at this please fix it!
my $compare = $self->{compare};
+ if ( defined $arg{compare} ) {
+ $self->{data} = [sort {&$compare($$$a,$$$b)} map {\$_} @{$arg{data}}];
+ }
+ else {
+ $self->{data} = [sort {&$compare($a,$b)} map {\$_} @{$arg{data}}];
+ }
- $self->{data} = [sort {&$compare($a,$b)} map {\$_} @{$arg{data}}];
-
#warn Dumper($self->{data});
$self->{cin} = 1;
Modified: packages/libmath-combinatorics-perl/trunk/t/01.t
===================================================================
--- packages/libmath-combinatorics-perl/trunk/t/01.t 2005-12-01 17:01:07 UTC (rev 1554)
+++ packages/libmath-combinatorics-perl/trunk/t/01.t 2005-12-01 17:03:47 UTC (rev 1555)
@@ -50,7 +50,7 @@
while(my(@combo) = $c->next_combination){
$f++;
}
-ok($f == 6);
+ok($f == 6, ">>> $f == 6 <<<");
@data = ([],[],[],[]);
$c = Math::Combinatorics->new(
@@ -61,7 +61,7 @@
while(my(@combo) = $c->next_combination){
$f++;
}
-ok($f == 6);
+ok($f == 6, ">>> $f == 6 <<<");
@data = (1..10);
$c = Math::Combinatorics->new(
@@ -72,7 +72,7 @@
while(my(@combo) = $c->next_combination){
$f++;
}
-ok($f == 45);
+ok($f == 45, ">>> $f == 45 <<<");
#####################
# combine()
@@ -80,10 +80,10 @@
@data = qw( a b c d );
@r = combine(2, at data);
-ok(scalar(@r) == 6);
+ok(scalar(@r) == 6, ">>> ".scalar(@r)." == 6 <<<");
@r = combine(3, at data);
-ok(scalar(@r) == 4);
+ok(scalar(@r) == 4, ">>> ".scalar(@r)." == 6 <<<");
#####################
# next_multiset
@@ -98,7 +98,7 @@
while(my(@combo) = $c->next_multiset){
$f++;
}
-ok($f == 6);
+ok($f == 6, ">>> $f == 6 <<<");
$c = Math::Combinatorics->new(
data => \@data,
@@ -109,7 +109,7 @@
while(my(@combo) = $c->next_multiset){
$f++;
}
-ok($f == 7);
+ok($f == 7, ">>> $f == 7 <<<");
#####################
# next_permutation()
Copied: packages/libmath-combinatorics-perl/trunk/t/02.t (from rev 1554, packages/libmath-combinatorics-perl/branches/upstream/current/t/02.t)
Copied: packages/libmath-combinatorics-perl/trunk/t/03.t (from rev 1554, packages/libmath-combinatorics-perl/branches/upstream/current/t/03.t)
More information about the Pkg-perl-cvs-commits
mailing list