"FunctionType" ()
"FunctionType" ()
{ty1, ty2, …}tyres
represents a function type with specified argument and result types.
Details
- Function types can be used in Typed and related constructs to specify a type.
Expression Conversions
- CompiledCodeFunction expressions can be converted into compiled code elements with function types.
- A code element representing a function type cannot currently be converted into an expression.
From Expressions
To Expressions
Examples
Basic Examples (1)
Function types can be used as an input to a CompiledCodeFunction. Create a function that takes a "MachineInteger" as argument:
cf1 = FunctionCompile[Function[Typed[arg, "MachineInteger"], arg + 1]]A function with argument of a function and a number:
cf2 = FunctionCompile[Function[{Typed[fun, {"MachineInteger"} -> "MachineInteger"], Typed[arg, "MachineInteger"]}, fun[arg]]]Call the function passing in the appropriate arguments:
cf2[cf1, 10]See Also
Function Typed TypeSpecifier FunctionCompile
Compiled Types: Boolean Integer64 Real64 ComplexReal64
Tech Notes
Related Guides
History
Introduced in 2019 (12.0)