TimTeaFan/loopurrr

`as_loop()` doesn't work correctly on `pmap`

TimTeaFan opened this issue · 0 comments

library(loopurrr)
#> Loading required package: purrr

x <- list(1, 1, 1)
y <- list(10, 20, 30)
z <- list(100, 200, 300)
a <- list(x, y, z)

# expected
pmap(a, sum)
#> [[1]]
#> [1] 111
#> 
#> [[2]]
#> [1] 221
#> 
#> [[3]]
#> [1] 331

# doesn't work
pmap(a, sum) %>% as_loop()
#> Error in !is_clipr: invalid argument type

# works!
pmap(list(x, y, z), sum) %>% as_loop()
#> Error in !is_clipr: invalid argument type

Created on 2022-10-05 by the reprex package (v0.3.0)