Open
Description
Passing any .options
causes all arguments to foreach()
to be evaluated eagerly in a context where that may not be appropriate:
library(foreach)
foreach(i = 1:3) %:% foreach(j = i:3, .options.foo = "bar") %do% seq(i, j) |> str()
#> Error in eval(expr, envir, enclos): object 'i' not found
# Expected result
foreach(i = 1:3) %:% foreach(j = i:3) %do% seq(i, j) |> str()
#> List of 3
#> $ :List of 3
#> ..$ : int 1
#> ..$ : int [1:2] 1 2
#> ..$ : int [1:3] 1 2 3
#> $ :List of 2
#> ..$ : int 2
#> ..$ : int [1:2] 2 3
#> $ :List of 1
#> ..$ : int 3
Discovered via this StackOverflow question: https://stackoverflow.com/q/76291120/4550695
Metadata
Metadata
Assignees
Labels
No labels