nealrichardson commented on a change in pull request #11156:
URL: https://github.com/apache/arrow/pull/11156#discussion_r708595599
##########
File path: r/R/util.R
##########
@@ -58,10 +58,22 @@ r_symbolic_constants <- c(
"NA_integer_", "NA_real_", "NA_complex_", "NA_character_"
)
+is_function <- function(expr, name) {
+ if (!is.call(expr)) {
+ return(FALSE)
+ } else {
+ if (deparse(expr[[1]]) == name) {
+ return(TRUE)
+ }
+ out <- lapply(expr, is_function, name)
+ }
+ any(vapply(out, isTRUE, TRUE))
+}
+
all_funs <- function(expr) {
# Don't use setdiff so that we preserve duplicates
Review comment:
```suggestion
# It is not sufficient to simply do something like `setdiff(all.names,
all.vars)` here
# because that would fail to return the names of functions that share
names with
# variables. To preserve duplicates, call `all.names()` not `all_names()`
here.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]