R/current.R

Defines functions current

Documented in current

#' Get the current value of an Iterator without changing its state
#'
#' @description An `Iterator` `yield`s a variable every time `yield_next()` is called.
#' Get the current value of that variable without changing the state of the Iterator.
#'
#' @param iter An `Iterator` object
#'
#' @return The current value of `iter`
#' @export

current <- function(iter) {
  iter$initial[[as.character(iter$yield)]]
}
jacgoldsm/pytools documentation built on March 17, 2021, 6:36 a.m.