InertEvaluate[inertExpr]
evaluates an "InertExpression", returning a new "InertExpression" in compiled code.
InertEvaluate
InertEvaluate[inertExpr]
evaluates an "InertExpression", returning a new "InertExpression" in compiled code.
Details
- InertEvaluate is only available in compiled code.
- "InertExpression" returned by InertEvaluate is inert and will only continue to evaluate on subsequent calls to InertEvaluate. »
Examples
open all close allBasic Examples (1)
Properties & Relations (1)
Define a function in the Wolfram Engine:
f[x_] := x ^ 2Call the function from compiled code using InertEvaluate alongside Construct and InertExpression:
cf = FunctionCompile[
Function[Typed[arg, "MachineInteger"],
Cast[
InertEvaluate[Construct[InertExpression[f], Cast[arg, "InertExpression"]]],
"MachineInteger"
]
]
]cf[10]The same result can be accomplished using KernelFunction:
cf1 = FunctionCompile[
Function[Typed[arg, "MachineInteger"],
TypeHint[KernelFunction[f], {"MachineInteger"} -> "MachineInteger"][arg]
]
]cf1[10]Possible Issues (1)
Expressions continue to be evaluated after being returned from ReleaseHold:
heldExpr = Hold[x + 2 + 3];
expr = ReleaseHold[heldExpr]x = 3;exprHead[expr]In contrast, "InertExpression" returned by InertEvaluate continues to be inert:
cf = FunctionCompile[Function[{}, Module[{inertExpr, expr},
inertExpr = InertExpression[y + 2 + 3];
expr = InertEvaluate[inertExpr];
InertEvaluate[InertExpression[y = 3]];
Head[expr]
]]]cf[]See Also
InertExpression Construct KernelFunction KernelEvaluate ReleaseHold Activate
Compiled Types: InertExpression
History
Text
Wolfram Research (2022), InertEvaluate, Wolfram Language function, https://reference.wolfram.com/language/ref/InertEvaluate.html.
CMS
Wolfram Language. 2022. "InertEvaluate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/InertEvaluate.html.
APA
Wolfram Language. (2022). InertEvaluate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/InertEvaluate.html
BibTeX
@misc{reference.wolfram_2026_inertevaluate, author="Wolfram Research", title="{InertEvaluate}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/InertEvaluate.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_inertevaluate, organization={Wolfram Research}, title={InertEvaluate}, year={2022}, url={https://reference.wolfram.com/language/ref/InertEvaluate.html}, note=[Accessed: 12-June-2026]}