Everything about Generator (computer programming)
Routine that generates a sequence of values
In computer science, a generator is a routine that can be used to control the iteration behaviour of a loop. All generators are also iterators. A generator is very similar to a function that returns an array, in that a generator has parameters, can be called, and generates a sequence of values. However, instead of building an array containing all the values and returning them all at once, a generator yields the values one at a time, which requires less memory and allows the caller to get started processing the first few values immediately. In short, a generator looks like a function but behaves like an iterator. Wikipedia →
🧭 Start here: a 6-step reading path
- Read the overview: Generator (computer programming)A 5-minute orientation
- Skim a recent paper: The effect of generative artificial intelligence (AI)-based tool use on students' computational thinking skills, programming self-efficacy and motivationInfluential work since 2022
- Pick up a classic book: Advances in Computers, Volume 49 (Advances in Computers)The most-reprinted book on the subject
- Go sideways: IteratorA closely related topic
- Go sideways: Lazy evaluationA closely related topic
📖 Definitions
No dictionary entry for this exact phrase.
🗂️ The subject at a glance
🏆 Landmark papers (most cited)
- No matching papers found.
🆕 Influential since 2022
📚 Books worth reading
Advances in Computers, Volume 49 (Advances in Computers)Marvin V. Zelkowitz, Marshall C. Yovits · 1995
Computer ConceptsJune Jamrich Parsons, Dan Oja · 1996
Systems Analysis and DesignAlan Dennis, Barbara Haley Wixom · 2000
Learning PythonMark Lutz, David Ascher · 1999
JavaScriptDavid Flanagan · 1996
Invitation to Computer ScienceG. Michael Schneider, Judith L. Gersting · 1995
Operating System ConceptsAbraham Silberschatz · 1988
IEEE standard for information technologyInstitute of Electrical and Electronics Engineers · 1991
Ranked by number of editions on Open Library, a rough measure of how lasting a book is.
🔗 Related topics
- Iterator In computer programming, an iterator is an object that progressively provides access to each item of a collection, in order. A collection may provide multiple…
- Lazy evaluation In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an expression until its value…
- Control flow In software, control flow (or flow of control) describes how execution progresses from one command to the next. In many contexts, such as machine code…
- Coroutine Coroutines are computer program components that can be suspended and resumed — generalizing subroutines — for cooperative multitasking. Coroutines are…
- Channel (programming) Computer programming portal In computing, a channel is a model for inter-thread communication and synchronization via message passing. A message may be…
- Java syntax The syntax of Java is the set of rules defining how a Java program is written and interpreted. The syntax is mostly derived from C and C++. Unlike C++…
- Tail call In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the…
- PHP syntax and semantics The syntax and semantics of PHP, a programming language, form a set of rules that define how a PHP program can be written and interpreted. Historically…