generators: Generators: Iterable functions

Description Details See Also

Description

Generators are functions that contain a mutable internal state. Calls of the function modify that state, making the function iterable: repeated calls of the function return different values. When used correctly, generators offer an efficient solution to many computational problems. This package provides a grammar for working with these tools.

Details

This package was inspired by Reginald Braithwaite's book on Javascript Javascript Allonge and Jeff Knupp's blog post on using generators in Python. It also borrows heavily from Rust's iterators methods, which inspired the framework of iterator adaptors and consumers.

Generators behave much like iterators, which are objects with a mutable internal state. There are multiple implementations of iterators in R. See below.

See Also

iterators and itertools


michaelquinn32/generators documentation built on May 22, 2019, 9:52 p.m.