Content deleted Content added
→Python: fix code |
→Lisp: added Haskell section |
||
Line 295:
=== Lisp ===
[[Common Lisp]] also does not natively provide generators, yet various library implementations exist, such as [http://cliki.net/pygen pygen].
=== Haskell ===
In [[Haskell_(programming_language)|Haskell]], with its [[lazy evaluation]] model, everything is a generator - every datum created with non-strict data constructor that is, generated on demand. For example,
<source lang="haskell">
fibgen (a,b) = a : fibgen(b,a+b)
-- Main> take 10 (fibgen (0,1))
-- [0,1,1,2,3,5,8,13,21,34]
</source>
where <code>(:)</code> is a non-strict list constructor, ''cons''.
==See also==
|