Runtime evaluation/In an environment: Difference between revisions

no edit summary
(omit this task from D)
No edit summary
Line 147:
<pre>F(10) - F(5) = 55 - 5 = 50</pre>
 
=={{header|J}}==
The following satisfies the requirments:
<lang j>
EvalWithX=. monad : 0
'CODE V0 V1'=. y
(". CODE [ x=. V1) - (". CODE [ x=. V0)
)
EvalWithX '^x';0;1
1.71828183
</lang>
But, it is easier via point-free coding:
<lang j>
eval=. (0&({::) (128!:2) 2&({::)) - 0&({::) (128!:2) 1&({::)
eval '^';0;1
1.71828183
</lang>
=={{header|JavaScript}}==
 
Anonymous user