r-lib / coro

Coroutines for R
https://coro.r-lib.org/
Other
160 stars 8 forks source link

Iterate could return invisibly #10

Closed dfalbel closed 4 years ago

dfalbel commented 5 years ago

Iterate will always return a NULL when finishing the iteration. Can we make this invisible?

library(flowery)

iterate(
  for (x in as_iterator(1:3)) {
    print(x)
  }
)
#> [1] 1
#> [1] 2
#> [1] 3
#> NULL

Created on 2019-04-17 by the reprex package (v0.2.1)

lionel- commented 5 years ago

That makes sense, this would be consistent with for.

dfalbel commented 5 years ago

Ok! I can make a PR for this later today