Sorry, Jason:

Your codes did not succeed in my trial either. What I suspect is that
nothing is wrong with the print stuff. Instead, the combination result
is systematically incomplete, since one can check the number of items in
the resulting array, which is not 5 while should be.

Ying

-----Original Message-----
From: Messmer, Jason [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 02, 2004 4:28 PM
To: Bertrand NICAISE; Ying Yang; [EMAIL PROTECTED]
Subject: RE: Incomplete combinatorics


print @{$ref}, "\n";
or
print @$_, "\n" foreach @b -- I think this would work too;

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Bertrand NICAISE
Sent: Tuesday, November 02, 2004 4:13 PM
To: Ying Yang; [EMAIL PROTECTED]
Subject: RE: Incomplete combinatorics


It works with

#!/usr/bin/perl
use strict 'vars';
use strict 'subs';
use strict 'refs';
use Math::Combinatorics;

my @a = (["a",],["b",],["c",],["d",], ["e",]);
print "[EMAIL PROTECTED]:\n\n";
my @b = combine(4,@a);
foreach my $ref (@b) {
        print @{$ref} ."\n"; ###### here is the difference.
}

-----Message d'origine-----
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] la part de Ying
Yang Envoyé : mardi 2 novembre 2004 16:15 À :
[EMAIL PROTECTED]
Objet : Incomplete combinatorics


Dear All:

I need to do combinatorics and downloaded the perl module
combinatorics.pm (Math-Combinatorics-0.02.tar.gz) from CPAN
http://www.cpan.org/modules/01modules.index.html .

I tried a very simple test case:
----------------------------------------
#!/usr/bin/perl
use strict 'vars';
use strict 'subs';
use strict 'refs';
use Math::Combinatorics;

my @a = (["a",],["b",],["c",],["d",], ["e",]);
print "[EMAIL PROTECTED]:\n\n";
my @b = combine(4,@a);
foreach my $ref (@b) {
        print "@$ref\n";
}
----------------------------------------

On ActivePerl installed on Windows XP, however, incomplete results are
produced. Combining 4 out of 5 elements should give you 5 alternatives,
while ActivePerl only gives 3 alternatives.
----------------------------------------
ARRAY(0x2251d0) ARRAY(0x2252a8) ARRAY(0x1824430) ARRAY(0x184f9b0)
ARRAY(0x184fae8):

ARRAY(0x2251d0) ARRAY(0x2252a8) ARRAY(0x1824430) ARRAY(0x184f9b0)
ARRAY(0x2251d0) ARRAY(0x2252a8) ARRAY(0x1824430) ARRAY(0x184fae8)
ARRAY(0x2251d0) ARRAY(0x2252a8) ARRAY(0x184f9b0) ARRAY(0x184fae8)
----------------------------------------

I have tried the same codes on Linix (simulator: cygwin). 4 alternatives
are produced, which is still incomplete:
----------------------------------------
ARRAY(0x10111190) ARRAY(0x101112c8) ARRAY(0x1015d328) ARRAY(0x1013a84c)
ARRAY(0x1013a870):

ARRAY(0x10111190) ARRAY(0x101112c8) ARRAY(0x1015d328) ARRAY(0x1013a84c)
ARRAY(0x10111190) ARRAY(0x101112c8) ARRAY(0x1015d328) ARRAY(0x1013a870)
ARRAY(0x10111190) ARRAY(0x1013a84c) ARRAY(0x1015d328) ARRAY(0x1013a870)
ARRAY(0x101112c8) ARRAY(0x1013a84c) ARRAY(0x1015d328) ARRAY(0x1013a870)
-----------------------------------------

Can anyone tell me why? Thanks a lot,


Ying


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to