-
See Also
- Interpreter
- Restricted
- Failure
- HoldComplete
-
- Interpreter Types
- Expression
- HeldExpression
- InactiveExpression
- SemanticExpression
- InactiveSemanticExpression
- MathExpression
- MathFormula
- WolframLanguageSymbol
- HeldMathExpression
- InactiveMathExpression
- HeldMathFormula
- InactiveMathFormula
- ComputedWolframLanguageSymbol
- Related Guides
-
-
See Also
- Interpreter
- Restricted
- Failure
- HoldComplete
-
- Interpreter Types
- Expression
- HeldExpression
- InactiveExpression
- SemanticExpression
- InactiveSemanticExpression
- MathExpression
- MathFormula
- WolframLanguageSymbol
- HeldMathExpression
- InactiveMathExpression
- HeldMathFormula
- InactiveMathFormula
- ComputedWolframLanguageSymbol
- Related Guides
-
See Also
"HeldSemanticExpression" (Interpreter Type)
Details
- "HeldSemanticExpression" can be used in Interpreter and related constructs, including deployed smart form fields.
- Use of "HeldSemanticExpression" does not require connectivity to the Wolfram Cloud.
- "HeldSemanticExpression" keeps its result unevaluated by wrapping it in HoldComplete.
Restriction Specifications
-
Restricted["HeldSemanticExpression",{{choice1,…}}] one among choices Restricted["HeldSemanticExpression",symbols] an expression involving only the given symbols (All, Automatic, or an explicit list) Restricted["HeldSemanticExpression",symbols,contexts] an expression involving only the given symbols or symbols in the given contexts (All, Automatic, or an explicit list) Restricted["HeldSemanticExpression",symbols,contexts,resultcontext] an expression involving only the given symbols or symbols in the given contexts, where the new symbols are created in resultcontext
Interpretation
- "HeldSemanticExpression" yields a Wolfram Language expression wrapped in HoldComplete.
Examples
Basic Examples (7)
Interpret expressions and avoid evaluation:
Interpreter["HeldSemanticExpression"]["int sin(x) from -pi to pi"]Interpreter["HeldSemanticExpression"]["author of Pride and Prijudice"]Find out Wolfram Language representations of natural-language queries:
Interpreter["HeldSemanticExpression"]["second derivative of log x"]No evaluation is attempted when matching the choices:
Interpreter[Restricted["HeldSemanticExpression", {{1, 2, 3, 4}}]]["two plus one"]Interpreter[Restricted["HeldSemanticExpression", {{2, HoldComplete[2 + 1]}}]]["two plus one"]By default, all symbols are allowed. Restrict to a list of allowed symbols:
Interpreter[Restricted["HeldSemanticExpression", {Plus, Times, Equal}]]["6*4==16+8"]Interpreter[Restricted["HeldSemanticExpression", {Plus, Times, Equal}]]["6/4==16+8"]By default, new symbols are created in $Context, but a custom context can be specified:
Interpreter[Restricted["HeldSemanticExpression", All, Automatic, Automatic]]["y + 2"]
Context[y]Interpreter[Restricted["HeldSemanticExpression", All, Automatic, "mycontext`"]]["j + 2"]
Context[j]Specify contexts for the allowed and output symbols:
mycontext`b = 10;
Interpreter[Restricted["HeldSemanticExpression", Automatic, {"mycontext`", "System`"}, "mycontext`"]]["a+b"]
Context[a]Prevent the creation of any new symbol:
Interpreter[Restricted["HeldSemanticExpression", Automatic, Automatic, None]]["cos(pi)"]Interpreter[Restricted["SemanticExpression", Automatic, Automatic, None]]["cos(x)"]See Also
Interpreter Restricted Failure HoldComplete
Interpreter Types: Expression HeldExpression InactiveExpression SemanticExpression InactiveSemanticExpression MathExpression MathFormula WolframLanguageSymbol HeldMathExpression InactiveMathExpression HeldMathFormula InactiveMathFormula ComputedWolframLanguageSymbol
Related Guides
History
Introduced in 2014 (10.0)