On Wed, Apr 03, 2002 at 12:53:33PM -0500, John Siracusa wrote:
> So it's the order that they appear that determines their binding?  How would
> something like this (Perl 5 code) be represented:
> 
>   sub reverse_minus { $_[1] - $_[0] }
> 
> I would have guessed it'd be:
> 
>     { $^b - $^a }
> 
> But if the place-holder names can be anything, I'm not sure how you could
> bind place-holders "out of order" with respect to the things that they
> alias.

If I remember correctly, there are also positional placeholders:

        { $^1 - $^0 }

or you should be able to do this:

        -> $a,$b { $b - $a }

if you don't need the currying semantics of the placeholders, but

        our %operator is private //= (
            '*'  => -> $a,$b { $a * $b },
            '/'  => -> $a,$b { $a / $b },
            '~'  => -> $a,$b { ($a + $b) / 2 },
        );

looks strange.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to