nseval (version 0.4)

arg_env: Get information about currently bound arguments.

Description

These are shortcut methods for querying current bindings. For example, arg_env(x) is equivalent to env(arg(x)), is_forced(x, y) is equivalent to forced(arg_list(x,y)), dots_exprs(...) is equivalent to exprs(dots(...)), and so on. The shortcut forms skip the construction of the intermediate quotation objects.

is_default determines whether an argument is bound to the function's default value for that argument. It must be called before the arguments have been forced (afterwards it will return FALSE).

Usage

arg_env(sym, env = arg_env_(quote(sym), environment()))

arg_env_(sym, env = arg_env_(quote(sym), environment()))

arg_expr(sym, env = arg_env_(quote(sym), environment()))

arg_expr_(sym, env = arg_env_(quote(sym), environment()))

dots_envs(...)

dots_exprs(...)

is_forced(...)

is_forced_(syms, envs)

is_literal(...)

is_literal_(syms, envs)

is_missing(...)

is_missing_(syms, envs, recursive = TRUE)

is_promise(...)

is_promise_(syms, envs)

is_default(...)

is_default_(syms, envs = arg_env(syms))

Arguments

sym

For arg_env, etc, a bare name (not forced). For the normally evaluating arg_env_ and so on, name.

env

The environment to search in.

...

Bare variable names (for is_*_) or expressions (for dots_*). Not forced.

syms

A character vector or list of symbols.

envs

An environment or list of environments.

recursive

Whether to recursively unwrap before testing for missingness.

Value

arg_expr extracts an expression from a named argument.

dots_exprs(...) is equivalent to exprs(dots(...)) (which is nearly equivalent to alist(...).)

is_literal(x) returns TRUE if x could be a source literal. Specifically this tests whether it is X is bound to a singleton vector or a missing_value.

is_missing(...) checks whether a variable is missing, without forcing. It is similar to missing but can take multiple arguments.

is_promise returns TRUE if the given variable is bound to a promise. Not all arguments are bound to promises; byte-compiled code often omits creating a promise for literal arguments

is_default returns a logical vector.