12 lines
752 B
Plaintext
12 lines
752 B
Plaintext
Given a program in the language (as a string or AST) with a free variable named <var>x</var> (or another name if that is not valid syntax), evaluate it with <var>x</var> bound to a provided value, then evaluate it again with <var>x</var> bound to another provided value, then subtract the result of the first from the second and return or print it.
|
|
|
|
Do so in a way which:
|
|
* does not involve string manipulation of the input source code
|
|
* is plausibly extensible to a runtime-chosen set of bindings rather than just <var>x</var>
|
|
* does not make <var>x</var> a ''global'' variable
|
|
or note that these are impossible.
|
|
|
|
===See also===
|
|
* For more general examples and language-specific details, see [[Eval]].
|
|
* [[Dynamic variable names]] is a similar task.
|