FunctionDeclaration
FunctionDeclaration[name,typedfun]
declares name to be a typed function suitable for use in a compiler environment.
Details

- The typed function in FunctionDeclaration is typically of the form Typed[{t1,t2,…}tout]@Function[{x1,x2,…},body].
- The functions declared by FunctionDeclaration can be used in FunctionCompile.
- The functions declared by FunctionDeclaration can be added to compiler environments with CompilerEnvironmentAppendTo.
- The name used in FunctionDeclaration can be used in more than one declaration so long as they have different types.
- The functions declared in FunctionDeclaration can be used in other function declarations.
Examples
Basic Examples (5)
FunctionDeclaration can be used in FunctionCompile:
The compilation uses the function declaration:
A function declaration can be used more than once:
Add a definition to a compiler environment:
Use the compiler environment in a compilation:
The compilation uses the function declaration:
A function declaration can be used more than once:
A function name can be used in more than one declaration:
A function declaration can call another declaration:
Add a definition to the default compiler environment:
Now there is no need to use a CompilerEnvironment option:
The default compiler environment can be restored to its default state:
Text
Wolfram Research (2021), FunctionDeclaration, Wolfram Language function, https://reference.wolfram.com/language/ref/FunctionDeclaration.html.
CMS
Wolfram Language. 2021. "FunctionDeclaration." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FunctionDeclaration.html.
APA
Wolfram Language. (2021). FunctionDeclaration. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FunctionDeclaration.html