Jump to content

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

m
→‎{{header|R}}: Syntax highlighting.
(added AWK)
m (→‎{{header|R}}: Syntax highlighting.)
Line 461:
</pre>
=={{header|R}}==
<lang Rrsplus>expressions <- alist(-x ^ p, -(x) ^ p, (-x) ^ p, -(x ^ p))
x <- c(-5, -5, 5, 5)
p <- c(2, 3, 2, 3)
Line 475:
5 2 -25 -25 25 -25
5 3 -125 -125 -125 -125</pre>
 
=={{header|Raku}}==
In Raku by default, infix exponentiation binds tighter than unary negation. It is trivial however to define your own infix operators with whatever precedence level meets the needs of your program.
331

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.