Top "Generator" questions

A generator is a generalisation of a subroutine, primarily used to simplify the writing of iterators.

Python: make a list generator JSON serializable

How can I concat a list of JSON files into a huge JSON array? I've 5000 files and 550 000 list items. My …

python json out-of-memory generator
If range() is a generator in Python 3.3, why can I not call next() on a range?

Perhaps I've fallen victim to misinformation on the web, but I think it's more likely just that I've misunderstood something. …

python python-3.x iterator generator typeerror
Recommendations of static site generator which accepts Markdown documents?

I'm looking for static site generator which accepts Markdown documents as input source code. I used Markdoc, but it looks …

generator markdown static-site
The idiomatic way to implement generators (yield) in Golang for recursive functions

[ Note: I read Python-style generators in Go, this is not a duplicate of it. ] In Python / Ruby / JavaScript / ECMAScript 6, generator …

recursion go generator yield
tqdm show progress for a generator I know the length of

I'm looping over a large file that I know the length of, but am processing lazily since it's too large …

python generator tqdm
Lexer written in Javascript?

I have a project where a user needs to define a set of instructions for a ui that is completely …

javascript parsing generator lexer
C++ - Play back a tone generated from a sinusoidal wave

Hey everyone, I'm currently trying to figure out how to play back a tone I have generated using a sinusoidal …

c++ audio generator wave trigonometry
What is the result of a yield expression in Python?

I know that yield turns a function into a generator, but what is the return value of the yield expression …

python generator yield
How do I scale down numbers from rand()?

The following code outputs a random number each second: int main () { srand(time(NULL)); // Seeds number generator with execution time. …

c++ random generator mersenne-twister
Does node.js support yield?

Is there any way to get generators into node.js? I'm currently faking them with callbacks, but I have to …

node.js generator