Runtime evaluation/In an environment: Difference between revisions
Runtime evaluation/In an environment (view source)
Revision as of 13:27, 26 February 2023
, 1 year ago→{{header|RPL}}: Alternative
m (→{{header|RPL}}) |
(→{{header|RPL}}: Alternative) |
||
Line 992:
=={{header|RPL}}==
A first way to answer the task is to use the possibility of passing local variables from one program to another, the calling program being in charge of achieving the binding of values to the x variable.
≪ 2 x ^ ≫ 'POWR2' STO
{{in}}
<pre>
5 3 DIFFP
▲3 5 ≪ → x ≪ POWR2 SWAP ≫ → x ≪ POWR2 - ≫ EVAL
</pre>
{{out}}
<pre>
1: 24
</pre>
Another solution is to let the algebraic interpreter do the binding:
≪ → x ≪ 2 x ^ ≫ ≫ 'POWR2' STO
{{in}}
<pre>
'POWR2(5)-POWR2(3)' EVAL
</pre>
{{out}}
|