On May 4, 2005, at 10:00, Wijaya Edward wrote:


    my %hoa = @_;
    while (my $keys = $iter->next)
    {
       # given a representative in $keys generate the one we need
       my $composite_key = join '', sort { ... } @$keys;
Whether a sort is fine or not depends on details of the problem to
solve though, but you see the issues to take into account.



Thanks for your explanation, you are right it was broken. However apart from your suggestion, this also worked:

my $iter = Algorithm::ChooseSubsets->new([ sort keys %hoa], 2, 1);


Yes, this is analogous to the first workaround (only you did the sort inline), but as I explained in the following paragraphs that is also broken because it depends on the implementation of Algorithm::ChooseSubsets. Of course you can take that risk if that's fine with you, but if that code works for looks like moving the sort into the right place (the one in the second workaround of the previous mail) will work as well.


-- fxn



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to