-
Notifications
You must be signed in to change notification settings - Fork 292
Rewrite every(), some(), and none() in C
#1169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2dcb5f5
b32a384
3feea66
9e4aab5
dd6a89a
d54dfac
d38eacf
e72b2f2
bdde5ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,7 +60,6 @@ as_predicate <- function( | |
| .fn, | ||
| ..., | ||
| .mapper, | ||
| .allow_na = FALSE, | ||
| .purrr_error_call = caller_env(), | ||
| .purrr_error_arg = caller_arg(.fn) | ||
| ) { | ||
|
|
@@ -75,10 +74,6 @@ as_predicate <- function( | |
| out <- .fn(...) | ||
|
|
||
| if (!is_bool(out)) { | ||
| if (is_na(out) && .allow_na) { | ||
| # Always return a logical NA | ||
| return(NA) | ||
| } | ||
|
Comment on lines
-78
to
-81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've removed this because no one else uses it This was a fairly weird bit of purrr. I've changed this in the C code to strictly require a scalar logical vector, and added tests about this. This is a breaking change, but hopefully a very minor one. |
||
| cli::cli_abort( | ||
| "{.fn { .purrr_error_arg }} must return a single `TRUE` or `FALSE`, not {.obj_type_friendly {out}}.", | ||
| arg = .purrr_error_arg, | ||
|
|
@@ -115,8 +110,9 @@ vctrs_list_compat <- function( | |
| } | ||
|
|
||
| # When we want to use vctrs, but treat lists like purrr does | ||
| # Treat data frames and S3 scalar lists like bare lists. | ||
| # But ensure rcrd vctrs retain their class. | ||
| # | ||
| # Treats data frames and S3 scalar lists like bare lists. | ||
| # But ensures rcrd vctrs retain their class. | ||
| vctrs_vec_compat <- function(x, user_env) { | ||
| if (inherits(x, "by")) { | ||
| class(x) <- NULL | ||
|
|
@@ -127,7 +123,7 @@ vctrs_vec_compat <- function(x, user_env) { | |
| } else if (is.pairlist(x)) { | ||
| lifecycle::deprecate_soft( | ||
| when = "1.0.0", | ||
| what = I("Use of pairlists in map functions"), | ||
| what = I("Use of pairlists in purrr functions"), | ||
| details = "Please coerce explicitly with `as.list()`", | ||
| user_env = user_env | ||
| ) | ||
|
|
@@ -138,7 +134,7 @@ vctrs_vec_compat <- function(x, user_env) { | |
| } else if (is_call(x) || is.expression(x)) { | ||
| lifecycle::deprecate_soft( | ||
| when = "1.0.0", | ||
| what = I("Use of calls and pairlists in map functions"), | ||
| what = I("Use of calls and expressions in purrr functions"), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe We now use |
||
| details = "Please coerce explicitly with `as.list()`", | ||
| user_env = user_env | ||
| ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.