Skip to content

Commit d6a71ed

Browse files
reduce instead of for loop
1 parent 52a39e7 commit d6a71ed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

R/reindent.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ is_function_call <- function(pd) {
9595
#' @inheritParams apply_ref_indention_one
9696
apply_ref_indention <- function(flattened_pd) {
9797
target_tokens <- which(flattened_pd$id %in% flattened_pd$indention_ref_id)
98-
99-
# needs sequential update
100-
for (target_token in target_tokens) {
101-
flattened_pd <- apply_ref_indention_one(flattened_pd, target_token)
102-
}
98+
flattened_pd <- reduce(
99+
target_tokens,
100+
apply_ref_indention_one,
101+
.init = flattened_pd
102+
)
103103
flattened_pd
104104
}
105105

0 commit comments

Comments
 (0)