Generator (computer programming): Difference between revisions

Content deleted Content added
Haskell: bring the code in line with Python, for clearer comparison
Haskell: linkify
Line 235:
 
=== Haskell ===
In [[Haskell_(programming_language)|Haskell]], with its [[lazy evaluation]] model, everything is a generator - every datum created with a [[Non-strict evaluation|non-strict]] data constructor is generated on demand. For example,
<source lang="haskell">
countfrom n = n : countfrom (n+1)