lang_head

0th

Percentile

Return the head or tail of a call object

These functions return the head or the tail of a call. See section on calls as parse trees in lang(). They are equivalent to node_car() and node_cdr() but support quosures and check that the input is indeed a call before retrieving the head or tail (it is unsafe to do this without type checking).

lang_head() returns the head of the call without any conversion, unlike lang_name() which checks that the head is a symbol and converts it to a string. lang_tail() returns the pairlist of arguments (while lang_args() returns the same object converted to a regular list)

Usage
lang_head(lang)

lang_tail(lang)

Arguments
lang

Can be a call (language object), a formula quoting a call in the right-hand side, or a frame object from which to extract the call expression.

See Also

pairlist, lang_args(), lang()

Aliases
  • lang_head
  • lang_tail
Examples
# NOT RUN {
lang <- quote(foo(bar, baz))
lang_head(lang)
lang_tail(lang)
# }
Documentation reproduced from package rlang, version 0.1.6, License: GPL-3

Community examples

Looks like there are no examples yet.