Content deleted Content added
m →R: <ref> |
Added jq language |
||
Line 81:
However, most of the time custom generators are implemented with the "suspend" keyword which functions exactly like the "yield" keyword in CLU.
===Jq===
As in Icon, in [[Jq_(programming_language)|jq]] every expression is a generator. The infinite generator of primes can serve as an example:
<pre>
def primes:
def sieve(g):
first(g) as $n
| $n, sieve(g | select((. % $n) != 0))
;
sieve(range(2; infinite))
;
</pre>
===C++===
|