Default apply_right implementation: S4 dispatch to apply_right_S4.
# S3 method for default
apply_right(
pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name
)
left argument
pipe_right_arg argument
environment to evaluate in
name, if not NULL name of left argument.
character, name of pipe operator.
name, if not NULL name of right argument.
result
# simulate a function pointer
apply_right.list <- function(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name) {
pipe_right_arg$f(pipe_left_arg)
}
f <- list(f=sin)
2 %.>% f
#> Error: wrapr::apply_right_S4 default called with classes:
#> numeric
#> f list
#> must have a more specific S4 method defined to dispatch
f$f <- cos
2 %.>% f
#> Error: wrapr::apply_right_S4 default called with classes:
#> numeric
#> f list
#> must have a more specific S4 method defined to dispatch