You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
purrr::prepend fails for empty list due to the checking of the before param though (partly based on the documentation) I would expect it to work as base::append by default. Is there a reason for this?
If you agree that it should work for empty lists as well I am happy to submit a PR.
purrr::prepend(list(), "a")
#> Error in purrr::prepend(list(), "a"): before > 0 && before <= n is not TRUE
append("a", list())
#> [[1]]#> [1] "a"purrr::prepend(list("b"), "a")
#> [[1]]#> [1] "a"#> #> [[2]]#> [1] "b"
append("a", list("b"))
#> [[1]]#> [1] "a"#> #> [[2]]#> [1] "b"
Maybe before should have NULL as default argument? Then it'd mean to prepend at the beginning, even in the 0 case? If 1 is passed instead, we'd still get an error as currently happens because this means the user assumptions regarding the input vector are not fulfilled.
purrr::prepend
fails for empty list due to the checking of thebefore
param though (partly based on the documentation) I would expect it to work asbase::append
by default. Is there a reason for this?If you agree that it should work for empty lists as well I am happy to submit a PR.
Created on 2019-02-10 by the reprex package (v0.2.0).
My first idea for implementation:
The text was updated successfully, but these errors were encountered: