Exponentiation with infix operators in (or operating on) the base: Difference between revisions

m
→‎{{header|Raku}}: use Unicode '∧' in place of ASCII '^', to avoid warning
m (syntax highlighting fixup automation)
m (→‎{{header|Raku}}: use Unicode '∧' in place of ASCII '^', to avoid warning)
Line 749:
 
<syntaxhighlight lang="raku" line>sub infix:<↑> is looser(&prefix:<->) { $^a ** $^b }
sub infix:<^> is looser(&infix:<->) { $^a ** $^b }
 
use MONKEY;
Line 760:
 
"\nEven moreso: custom looser infix exponentiation is looser (lower) precedence than infix subtraction.",
('1 + -$x^x∧$p ', '1 + (-$x)^$p ', '1 + (-($x)^$p) ', '(1 + -$x)^$p ', '1 + -($x^x∧$p) ')
-> $message, $ops {
say $message;
Line 783:
 
Even moreso: custom looser infix exponentiation is looser (lower) precedence than infix subtraction.
x = -5 p = 2 │ 1 + -$x^x∧$p = 36 │ 1 + (-$x)^$p = 36 │ 1 + (-($x)^$p) = 26 │ (1 + -$x)^$p = 36 │ 1 + -($x^x∧$p) = -24
x = -5 p = 3 │ 1 + -$x^x∧$p = 216 │ 1 + (-$x)^$p = 216 │ 1 + (-($x)^$p) = 126 │ (1 + -$x)^$p = 216 │ 1 + -($x^x∧$p) = 126
x = 5 p = 2 │ 1 + -$x^x∧$p = 16 │ 1 + (-$x)^$p = 16 │ 1 + (-($x)^$p) = 26 │ (1 + -$x)^$p = 16 │ 1 + -($x^x∧$p) = -24
x = 5 p = 3 │ 1 + -$x^x∧$p = -64 │ 1 + (-$x)^$p = -64 │ 1 + (-($x)^$p) = -124 │ (1 + -$x)^$p = -64 │ 1 + -($x^x∧$p) = -124</pre>
 
=={{header|REXX}}==
2,392

edits