TypeEvaluate[expr]
represents a type created by evaluating expr.
TypeEvaluate
TypeEvaluate[expr]
represents a type created by evaluating expr.
Details
- TypeEvaluate can be used inside of ForAllType.
- TypeOf can be used inside TypeEvaluate to determine the type.
Examples
open all close allBasic Examples (2)
Represent the type of a function that accepts a packed array with rank r and returns a packed array with rank r+1:
type = ForAllType[r, {"PackedArray"::["MachineInteger", r]} -> "PackedArray"::["MachineInteger", TypeEvaluate[r + 1]]];Compile a program using a function with that type:
cf = FunctionCompile[{
FunctionDeclaration[addRank, Typed[type]@Function[array, {array}]]
}, Function[Typed[arg, "PackedArray"::["MachineInteger", 2]], addRank[arg]]]cf[{{1, 2, 3}, {4, 5, 6}}]TypeOf can be used with TypeEvaluate to determine the type in a declaration:
type = ForAllType[{elem},
Element[elem, "Numbers"],
{elem} -> TypeEvaluate[TypeOf[Re[elem]]]];cf = FunctionCompile[FunctionDeclaration[MyFun1, Typed[type]@Function[x, Re[x]]], Function[Typed[arg, "ComplexReal64"], MyFun1[arg]]]cf[4. + 5. I]Scope (1)
TypeOf can be involve nested code:
type = ForAllType[t, {t} -> TypeEvaluate[TypeOf[t + s, Typed[s, "Real64"]]]];Compile a program using a function with the specified type:
cf = FunctionCompile[{
FunctionDeclaration[addReal, Typed[type]@Function[x, x + 3.14]]},
Function[Typed[arg, "MachineInteger"], addReal[arg]]
]cf[10]Tech Notes
Related Guides
History
Text
Wolfram Research (2022), TypeEvaluate, Wolfram Language function, https://reference.wolfram.com/language/ref/TypeEvaluate.html.
CMS
Wolfram Language. 2022. "TypeEvaluate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TypeEvaluate.html.
APA
Wolfram Language. (2022). TypeEvaluate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TypeEvaluate.html
BibTeX
@misc{reference.wolfram_2026_typeevaluate, author="Wolfram Research", title="{TypeEvaluate}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/TypeEvaluate.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_typeevaluate, organization={Wolfram Research}, title={TypeEvaluate}, year={2022}, url={https://reference.wolfram.com/language/ref/TypeEvaluate.html}, note=[Accessed: 12-June-2026]}