removeConstIf | R Documentation |
This function identifies and eliminates
parts of if-else expressions that are known
at analysis time to be unreachable.
These are of the form if(FALSE) {...}
.
This is typically used to "comment" out code.
We want to eliminate it both to simplify and clarify the code
and also reduce the code we would compile (see RLLVMCompile
.
removeConstIf(expr)
expr |
the R function or expression to process |
The potentially modified expression/function with any dead if statements eliminated.
Duncan Temple Lang
f = function()
{
if(length(x) > 10)
print(x)
else if(length(x) > 5 && FALSE)
show(x)
else
cat("x is small\n")
}
removeConstIf(f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.