x %.|% f
stands for f(x[[1]], x[[2]], ..., x[[length(x)]])
.
v %|.% x
also stands for f(x[[1]], x[[2]], ..., x[[length(x)]])
.
The two operators are the same, the variation just allowing the user to choose the order they write things.
The mnemonic is: "data goes on the dot-side of the operator."
f %|.% args args %.|% f
f | function. |
---|---|
args | argument list or vector, entries expanded as function arguments. |
f(args) where args elements become individual arguments of f.
Note: the reduce operation is implemented by do.call()
, so has
standard R named argument semantics.
%|.%
: f reduce args
%.|%
: args expand f
#> [1] "prefix_1_suffix" "prefix_2_suffix" "prefix_3_suffix"# prefix_1_suffix" "prefix_2_suffix" "prefix_3_suffix" paste0 %|.% args#> [1] "prefix_1_suffix" "prefix_2_suffix" "prefix_3_suffix"# prefix_1_suffix" "prefix_2_suffix" "prefix_3_suffix"