constInputs | R Documentation |
This function determines which functions are "constant" in a function, i.e. read-only. These are the formal arguments/parameters that are not changed by code in the body of this function. The purpose of knowing this is that we can, in theory, avoid copying the value of the argument before calling this function, but still know that the content will not change. This is useful when compiling code.
This currently does not work recursively for calls to other functions. This will be added later.
constInputs(f)
f |
the function object whose parameters and body we process |
A character vector giving the names of the parameters that are not modified in the body of the function. THis might be empty.
Duncan Temple Lang
f =
function(x)
{
y = numeric(length(n))
for(i in seq(along = x))
y[i] = x[i]*2
}
constInputs(f) # "x"
g =
function(x)
{
for(i in seq(along = x))
x[i] = x[i]*2
}
constInputs(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.