Skip to main content

Questions tagged [generators]

For questions relating to generators, an iterable-like construct that allows for a lazily evaluated sequence of values generated by a generating function.

8 votes
1 answer
562 views

It seems to me that coroutines and derived abstractions like the iterators and generators are implemented the following way: When returning Move the function's stack frame to the heap Save a pointer ...
Matheus Moreira's user avatar
20 votes
5 answers
6k views

I used to code a lot in a language called Supercollider, which is a domain-specific language for sound synthesis and computer music. One really nice feature it has is coroutines. Python also has these ...
N. Virgo's user avatar
  • 301
6 votes
1 answer
204 views

Motivation I have seen many places saying that CPST (continuation-passing style transformation) can express all control flows, but the examples they give are relatively simple and do not involve any ...
Aster's user avatar
  • 3,508
10 votes
1 answer
357 views

Several languages, such as JavaScript, C#, and Python, have "generator" methods that lazily yield a series of values rather than returning a single one: ...
Bbrk24's user avatar
  • 9,672
1 vote
2 answers
233 views

For languages that allow generators (iterables where elements are determined by a function), what are the pros and cons of having a unique type for generators? For example, languages like python have ...
lyxal's user avatar
  • 2,045
5 votes
3 answers
219 views

Some programming languages allow you to create generators - lazily evaluated iterable objects that use a function to determine what the next item should be. For example, Python allows: ...
lyxal's user avatar
  • 2,045