Larry pointed out:

   > Yes, but has anyone pointed out that
   >
   >    @out = sort ^b cmp ^a, @in;
   >
   > won't do what people will certainly think it ought to?

It *will*, if C<sort> *names* the two values it passes to the
comparator!

E.g.:

            sub sort (^&comparator, @list) {
                for (1..@list**3) {
                    my ($i, $j) = (rand(@list), rand(@list));
                    @list[$i,$j] = @list[$j,$i]
                        unless $comparator->(a: $list[$i], b: $list[$j]);
                }
                return @list;
            }


(And now you know why I never fill in the IMPLEMENTATION section ;-)

Damian

Reply via email to