Runtime evaluation: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: removed OVERFLOW from PRE html tag.)
m (→‎{{header|REXX}}: changed section header comments, added/changed program comments, changed glyph for ellipsis.)
Line 987: Line 987:
=={{header|REXX}}==
=={{header|REXX}}==
This REXX program does a:
This REXX program does a:
<br> 1) run-time evaluation of an internal expression, and a
:::* &nbsp; &nbsp; run-time evaluation of an internal expression, &nbsp; and
<br> 2) run-time evaluation of a user-prompted expression.
:::* &nbsp; &nbsp; run-time evaluation of a user-prompted expression.
<lang rexx>/*REXX program to illustrate ability to execute code written at runtime.*/
<lang rexx>/*REXX program illustrates ability to execute code entered at "runtime".*/
numeric digits 10000000
numeric digits 10000000 /*ten million digits should do it*/
bee=51
bee=51
stuff='bee=min(-2,44); say 13*2 "[from inside the box."; abc=abs(bee)'
stuff= 'bee=min(-2,44); say 13*2 "[from inside the box.]"; abc=abs(bee)'
interpret stuff
interpret stuff
say 'bee=' bee
say 'bee=' bee
say 'abc=' abc
say 'abc=' abc
say
say
/* [↓] now, we hear from da user*/

say 'enter an expression:'
say 'enter an expression:'
pull expression
pull expression
Line 1,007: Line 1,007:
say
say
say 'length of result='length(?)
say 'length of result='length(?)
say ' left 50 bytes of result='left(?,50)'...'
say ' left 50 bytes of result='left(?,50)'···'
say 'right 50 bytes of result=...'right(?,50)
say 'right 50 bytes of result=···'right(?,50)


/*stick a fork in it, we're done.*/</lang>
/*stick a fork in it, we're done.*/</lang>
Line 1,014: Line 1,014:
<br>which happens to be the 27th Mersenne prime.
<br>which happens to be the 27th Mersenne prime.
<pre style="height:35ex">
<pre style="height:35ex">
26 [from inside the box.
26 [from inside the box.]
bee= -2
bee= -2
abc= 2
abc= 2
Line 1,024: Line 1,024:


length of result=13395
length of result=13395
left 50 bytes of result=85450982430363380319330070531840303650990159130402...
left 50 bytes of result=85450982430363380319330070531840303650990159130402···
right 50 bytes of result=...22977396345497637789562340536844867686961011228671
right 50 bytes of result=···22977396345497637789562340536844867686961011228671
</pre>
</pre>