Now for an actually interesting question:
what is the best way to wrap the following permutation generator
in separate threads, so that they can each pull from it ?
best -f
the following is an example from Math::Combinatorics, corrected for a
small flaw.
-----------------------------------------------------
#!/usr/bin/perl
use Math::Combinatorics;
use strict;
my ($o, @x, $p, @y);
$o = Math::Combinatorics->new( count=>3 , data=>[qw(. -)] ,
frequency=>[3,3] );
while ( my @x = $o->next_multiset ) {
my $p = Math::Combinatorics->new( data=>[EMAIL PROTECTED], frequency=>[map {1}
@x] );
while ( my @y = $p->next_string() ) {
print join " ", @y, "\n";
}
}
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm