# splice

0th

Percentile

##### Splice lists

• splice marks an object to be spliced. It is equivalent to using !!! in a function with tidy dots semantics.

Keywords
internal
##### Usage
splice(x)is_spliced(x)is_spliced_bare(x)dots_splice(..., .ignore_empty = c("trailing", "none", "all"))
##### Arguments
x

A list to splice.

...

Arguments with explicit (dots_list()) or list (dots_splice()) splicing semantics. The contents of spliced arguments are embedded in the returned list.

.ignore_empty

Whether to ignore empty arguments. Can be one of "trailing", "none", "all". If "trailing", only the last argument is ignored if it is empty.

##### Details

• dots_splice() is like dots_list() but automatically splices list inputs.

##### Standard splicing versus quoting splicing

The !!! operator works differently in standard functions taking dots with dots_list() than in quoting functions taking dots with enexprs() or enquos().

• In quoting functions !!! disaggregates its argument (let's call it x) into as many objects as there are elements in x. E.g. quo(foo(!!! c(1, 2))) is completely equivalent to quo(foo(1, 2)). The creation of those separate objects has an overhead but is typically not important when manipulating calls because function calls typically take a small number of arguments.

• In standard functions, disaggregating the spliced collection would have a negative performance impact in cases where dots_list() is used to build up data structures from user inputs. To avoid this spliced inputs are marked with splice() and the final list is built with (the equivalent of) flatten_if(dots, is_spliced).

Most of the time you should not care about the difference. However if you use a standard function taking tidy dots within a quoting function, the !!! operator will disaggregate its argument because the behaviour of the quasiquoting function has priority. You might then observe some performance cost in edge cases. Here is one example where this would happen:

purrr::rerun(10, dplyr::bind_rows(!!! x))


purrr::rerun() is a quoting function and dplyr::bind_rows() is a standard function. Because bind_rows() is called inside rerun(), the list x will be disaggregated into a pairlist of arguments. To avoid this you can use splice() instead:

purrr::rerun(10, dplyr::bind_rows(splice(x)))


##### Life cycle

• dots_splice() is in questioning stage. It is part of our experiments with dots semantics. Compared to dots_list(), dots_splice() automatically splices lists. We now lean towards adopting a single type of dots semantics (those of dots_list()) where splicing is explicit.

• splice() is in questioning stage. It is not clear whether it is really needed as there are other ways to avoid the performance issue discussed in the section above.

##### Aliases
• splice
• is_spliced
• is_spliced_bare
• dots_splice
Documentation reproduced from package rlang, version 0.2.2, License: GPL-3

### Community examples

Looks like there are no examples yet.