Clickbaity title but it's too meaty to pass up. I have this operator which I want to be right associative:
sub infix:<↑> ( Int:D \n, Int:D \m --> Int:D )
is assoc<right>
is equiv(&infix:<**>)
{ n ** m }
put "2**2**2**2 = ", 2**2**2**2;
put "2↑2↑2↑2 = ", 2↑2↑2↑2;
put "2↑ (2↑ (2↑2) ) = ", 2↑ (2↑ (2↑2) );
It's not right associative:
2**2**2**2 = 65536
2↑2↑2↑2 = 256
2↑ (2↑ (2↑2) ) = 65536
What am I not doing right (ahem)?
2**2**2**2 = 65536 2↑2↑2↑2 = 65536 2↑ (2↑ (2↑2) ) = 65536
. Seems that precedence has higher precedence. :) – Cooking