Eduardo Cavazos <[email protected]> writes:
This example showed up on the Perl 6 mailing list:
if any(@new_values) > all(@existing_values) {
$upper_limit = [max] @new_values;
}
Alex Shinn wrote:
This is O(n^2).
How about
(let ((new-max (apply max new-values))
(old-max (apply max existing-values)))
(if (> new-max old-max)
(set! upper-limit new-max)))
Yep, that's definately "the right thing" for the whole expression. :-)
The original note by Damien Conway was a list of examples of new
features in Perl 6, probably quickly thrown together:
http://article.gmane.org/gmane.comp.lang.perl.perl6.language/13633
I was mainly just thinking about how to express the junctive comparison
idea.
Side note; the Perl 6 spec says that junctions are run in parallel.
Ed