Description Usage Arguments Value Examples
Finds the value of the next iteration(s) of an Iterator object
and increments the Iterator to the next value(s). yield_more()
repeats
yield_next()
a specified number of times.
Refer to the number of the current iteration in yield_more()
with .iter
.
1 2 3 | yield_next(iter)
yield_more(iter, more = 1L)
|
iter |
An Iterator object |
more |
How many values to yield |
An object of whatever type result
evaluates to from the Iterator, or
a vector of that type in the case of yield_more(iter, more > 1L)
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | primes <- 2:10000 %>%
that_for_all(range(2, .x)) %>%
we_have(~.x %% .y != 0, "Iterator")
sequence <- yield_more(primes, 100)
# use `.iter` to reference the current iteration
rwd <- Iterator({
set.seed(seeds[.iter])
n <- n + sample(c(-1L, 1L), size = 1L, prob = c(0.25, 0.75))
},
initial = list(n = 0, seeds = 1:100),
yield = n)
yield_more(rwd, 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.