Qurak

Substitute values of variables in functions that hold their arguments

Workflow 5 steps, run in order in one session. Every step was executed against the engine and the output below is what it produced.

Step 1
x = 2;
e = Hold[x + 1]
Output
Hold[x + 1]
Step 2
x = 4;
ReleaseHold[e]
Output
5
Step 3
x = 4;
ReleaseHold[e]
Output
5
Step 4
x = 2;
Function[y, x + y]
Output
Function[y, x + y]
Step 5
x = 2;
With[{x = x}, Function[y, x + y]]
Output
Function[y, 2 + y]

Functions used

Related recipes

All recipes · Function reference · Use this from an MCP client