TypeHint[expr,type]

represents an expression of a specified type when compiled and gives expr when evaluated.

Details

  • TypeHint can be useful to migrate evaluated code to the compiler.
  • TypeHint is useful to specify types inside the body of a function.
  • The types used in TypeHint are the same as those used in Typed.

Examples

Basic Examples  (1)

Define a function that uses TypeHint:

TypeHint evaluates to its first argument:

TypeHint uses the type specification when compiled:

Wolfram Research (2022), TypeHint, Wolfram Language function, https://reference.wolfram.com/language/ref/TypeHint.html.

Text

Wolfram Research (2022), TypeHint, Wolfram Language function, https://reference.wolfram.com/language/ref/TypeHint.html.

CMS

Wolfram Language. 2022. "TypeHint." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TypeHint.html.

APA

Wolfram Language. (2022). TypeHint. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TypeHint.html

BibTeX

@misc{reference.wolfram_2024_typehint, author="Wolfram Research", title="{TypeHint}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/TypeHint.html}", note=[Accessed: 18-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_typehint, organization={Wolfram Research}, title={TypeHint}, year={2022}, url={https://reference.wolfram.com/language/ref/TypeHint.html}, note=[Accessed: 18-November-2024 ]}