Description Usage Arguments Value Examples
View source: R/recursiveiter.R
This is a constructor for custom iterator objects. It requires four functions, "next", "prev", "first", and "last", and additional parameters.
The state of the constructor is characterized by the variable i
.
The "next" and "prev" function must take i
and the parameters
and return the next and previous state variables respectively. The behavior where there is no more state left is arbitrary.
The "first" and "last" functions must take the additional parameters and return the initial and last state variables respectively.
The created object is an iterator of class recursiveiter
, which inherits
abstractiter
and iter
.
It can be used with foreach
and accepts as.list
conversion.
1 | recursiveiter(nextFunc, prevFunc, firstFunc, lastFunc, ...)
|
nextFunc, prevFunc |
Functions that take the iterator state and the parameters |
firstFunc, lastFunc |
Functions that take the parameters |
... |
additional parameters of the iterator |
iterator object
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.