nextElem: Get Next Element of Iterator

Description Usage Arguments Value Examples

View source: R/iterators.R

Description

nextElem is a generic function used to produce values. If a checkFunc was specified to the constructor, the potential iterated values will be passed to the checkFunc until the checkFunc returns TRUE. When the iterator has no more values, it calls stop with the message 'StopIteration'.

Usage

1
2
3
4
5
6
nextElem(obj, ...)

## S3 method for class 'containeriter'
nextElem(obj, ...)
## S3 method for class 'funiter'
nextElem(obj, ...)

Arguments

obj

an iterator object.

...

additional arguments that are ignored.

Value

The value.

Examples

1
2
3
4
  it <- iter(c('a', 'b', 'c'))
  print(nextElem(it))
  print(nextElem(it))
  print(nextElem(it))


iterators documentation built on May 19, 2017, 7:35 p.m.
Search within the iterators package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.