IfCompiled
IfCompiled[comp,uncomp]
gives comp when compiled and uncomp when evaluated.
Details
- IfCompiled[comp,uncomp] ignores uncomp when compiling and ignores comp when evaluating.
- Compilation for IfCompiled is carried out by FunctionCompile and related functions.
- IfCompiled can be useful to migrate evaluated code to the compiler.
Examples
open allclose allBasic Examples (1)
Define a function that uses IfCompiled:
During normal evaluation, this function returns the uncompiled result:
Compile the function. FunctionCompile compiles with the compiled branch of IfCompiled:
Scope (1)
Evaluation (1)
In evaluated mode, IfCompiled only processes the uncompiled argument:
In compiled mode, IfCompiled only processes the compiled argument:
Text
Wolfram Research (2022), IfCompiled, Wolfram Language function, https://reference.wolfram.com/language/ref/IfCompiled.html.
CMS
Wolfram Language. 2022. "IfCompiled." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/IfCompiled.html.
APA
Wolfram Language. (2022). IfCompiled. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/IfCompiled.html