Description Usage Arguments Details Value
Get funcion(s) from a single expression. Usually a single function, but not necessarily.
1 | func_from_expr(expr, rfile, env)
|
expr |
Expression to evaluate. |
rfile |
Name of the R file being parsed, to be able to use it in a warning message. |
env |
Environment to store the parsed objects in. |
If the expression has a function
token and at least
one assignment, then we assume that it is a function definition
and evaluate it to get the function name.
This is the current algorithm:
We evaluate the expression in env
.
Then we check if there is anything new in env
.
If there is a single new function, then we assume that the expression is the definition of this function, and use the function's name as expression name.
Otherwise (zero or more than one new functions),
we assume that the expression is not a function defition
and we assign it to the function body (_
).
Othewise we assume it is not a function definition.
A named list of length one. (It is easy to concatenate these lists in the caller, hence the format. A list with a name and an expression is less convenient.)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.