represents a literal value x for use as a type.
- LiteralType is often used as a parameter of other types. For example, the rank of a packed array is represented with a literal type "PackedArray"::["MachineInteger",LiteralType].
- In some cases, LiteralType is added implicitly, such as in "PackedArray"::["MachineInteger",2].
- Literal types can be integers, strings or Boolean values.
- The head LiteralType can generally be omitted for integer and Boolean values, but is required for string values.
Examplesopen allclose all
Basic Examples (1)
Compile a program for manipulating packed arrays whose types are represented with LiteralType:
Use TypeEvaluate to transform literal types in a function signature:
Wolfram Research (2022), LiteralType, Wolfram Language function, https://reference.wolfram.com/language/ref/LiteralType.html.
Wolfram Language. 2022. "LiteralType." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LiteralType.html.
Wolfram Language. (2022). LiteralType. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LiteralType.html