diff --git a/R/reduce.R b/R/reduce.R index 9f561318..89c8996b 100644 --- a/R/reduce.R +++ b/R/reduce.R @@ -7,6 +7,7 @@ #' function that takes two values and returns a single value: reducing #' `f` over `1:3` computes the value `f(f(1, 2), 3)`. #' +#' @inheritParams map #' @param ... Additional arguments passed on to the reduce function. #' #' We now generally recommend against using `...` to pass additional @@ -16,7 +17,7 @@ #' # Instead of #' x |> reduce(f, 1, 2, collapse = ",") #' # do: -#' x |> reduce(\(x) f(x, 1, 2, collapse = ",")) +#' x |> reduce(\(x, y) f(x, y, 1, 2, collapse = ",")) #' ``` #' #' This makes it easier to understand which arguments belong to which diff --git a/man/reduce.Rd b/man/reduce.Rd index 10e49951..470f5f73 100644 --- a/man/reduce.Rd +++ b/man/reduce.Rd @@ -10,6 +10,8 @@ reduce(.x, .f, ..., .init, .dir = c("forward", "backward")) reduce2(.x, .y, .f, ..., .init) } \arguments{ +\item{.x}{A list or atomic vector.} + \item{.f}{For \code{reduce()}, a 2-argument function. The function will be passed the accumulated value as the first argument and the "next" value as the second argument. @@ -29,7 +31,7 @@ We now generally recommend against using \code{...} to pass additional \if{html}{\out{
}}\preformatted{# Instead of x |> reduce(f, 1, 2, collapse = ",") # do: -x |> reduce(\\(x) f(x, 1, 2, collapse = ",")) +x |> reduce(\\(x, y) f(x, y, 1, 2, collapse = ",")) }\if{html}{\out{
}} This makes it easier to understand which arguments belong to which diff --git a/man/reduce_right.Rd b/man/reduce_right.Rd index e718ba61..8d80bcd8 100644 --- a/man/reduce_right.Rd +++ b/man/reduce_right.Rd @@ -13,6 +13,8 @@ reduce2_right(.x, .y, .f, ..., .init) accumulate_right(.x, .f, ..., .init) } \arguments{ +\item{.x}{A list or atomic vector.} + \item{.f}{For \code{reduce()}, a 2-argument function. The function will be passed the accumulated value as the first argument and the "next" value as the second argument. @@ -32,7 +34,7 @@ We now generally recommend against using \code{...} to pass additional \if{html}{\out{
}}\preformatted{# Instead of x |> reduce(f, 1, 2, collapse = ",") # do: -x |> reduce(\\(x) f(x, 1, 2, collapse = ",")) +x |> reduce(\\(x, y) f(x, y, 1, 2, collapse = ",")) }\if{html}{\out{
}} This makes it easier to understand which arguments belong to which