The definition operator is typically used in DSL packages like
data.table. It is also used in the tidyverse as a way
of unquoting names (see quasiquotation).
TRUE for calls to
TRUE for both formulas and
is_definition(x) new_definition(lhs, rhs, env = caller_env()) is_formulaish(x, scoped = NULL, lhs = NULL)
An object to test.
Expressions for the LHS and RHS of the definition.
The evaluation environment bundled with the definition.
The recommended way to use it is to capture arguments as
expressions or quosures. You can then give a special function
definition for the
:= symbol in an overscope. Note that if you
capture dots with
quos(), you need to disable
:= by setting
From rlang and data.table perspectives, this operator is not meant to be evaluated directly at top-level which is why the exported definitions issue an error.
These functions are experimental.
# A predicate is provided to distinguish formulas from the # colon-equals operator: is_definition(quote(a := b))#>  TRUEis_definition(a ~ b)#>  FALSE# is_formulaish() tests for both definitions and formulas: is_formulaish(a ~ b)#>  TRUEis_formulaish(quote(a := b))#>  TRUE