Luke Palmer wrote:

On 5/4/05, Larry Wall <[EMAIL PROTECTED]> wrote:

[<] could mean "monotonically increasing".

Not unless we make boolean operators magic. There are arguments for doing that, but I don't really want to think about how that would be done at the moment. Reduce over a straight-up (or left) boolean operator doesn't make much sense...

But the comparators *are* magic in Perl 6. They're not binary, they're n-ary. So, since:

    [<] @vals

actually means:

    @vals[0] < @vals[1] < @vals[2] < @vals[3]

we get the n-ary behaviour, which is true if those values *are* in that order.

Perhaps you're forgetting the difference between what "reduce" means mathematically, and how its semantics are approximated in Perl 5 (in List::Util). "Reduce" means "bung this operator in between each of the elements of this list". But there's no way[*] to do that directly in Perl 5, so we currently have to live with a pairwise binary approximation.

That's perhaps the nicest feature of Larry's proposed reduction operator: that it will finally allow us to implement the real semantics of "reduce" and so get all the handy metaoperators (sum, product, sum-of-squares, monotonicity, first-true, first-defined) we've been missing to date.


[*] Okay, that's not strictly true. Evil Damian is already contemplating how
    to implement n-ary reduction in Perl 5. Bwah-ha-ha-ha!

Reply via email to