R/iterator_with_state.R

Defines functions bubu

iterator_with_state <- bubu <- function() {
  i <- 0L

  nextEl <- function() (i <<- i + 1L)

  currentEl <- function() i

  list(
    nextElem = nextEl,
    currentElem = currentEl
  )
}
abeeisnotabug/loggr documentation built on Nov. 24, 2021, 8:31 p.m.