Re: Operator precedence fiddling

2011-12-23 Thread Stefan O'Rear
On Fri, Dec 23, 2011 at 10:59:58PM +1100, Kris Shannon wrote: > sub infix: ($a, $b = ($a foo 2 * 3 - $a)) is tighter(&infix:<*>) > { > $a == 0 ?? 1 foo 2 * 3 !! $a + $b > } > > say 1 foo (2 * 3); > # 7 > say (1 foo 2) * 3; > # 9 > > say 1 foo 2 * 3; > # 9 > > say infix:(1); > # Niecza: 7 >

Operator precedence fiddling

2011-12-23 Thread Kris Shannon
sub infix: ($a, $b = ($a foo 2 * 3 - $a)) is tighter(&infix:<*>) { $a == 0 ?? 1 foo 2 * 3 !! $a + $b } say 1 foo (2 * 3); # 7 say (1 foo 2) * 3; # 9 say 1 foo 2 * 3; # 9 say infix:(1); # Niecza: 7 say 0 foo 0; # Niecza: 9 The way that Niecza does this is to install the operator with de