Description Usage Arguments Value Examples
Clone an Iterator, making an exact copy that can then be modified separately.
This is a simple wrapper around rlang::env_clone()
. Optionally,
override old initial parameters.
1 |
iter |
an |
... |
optionally override the |
a copy of the Iterator
passed as a parameter
1 2 3 4 5 6 7 8 | it <- Iterator({m <- m + n}, list(m = 0, n = 1), m)
other <- clone(it)
yield_next(it)
current(other) == current(it) # false
it2 <- clone(other, n = 5)
yield_next(it2)
it2$initial$n # 5
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.