Knowledge (XXG)

Generator (computer programming)

Source 📝

40: 556:
It is possible to introduce generators into C++ using pre-processor macros. The resulting code might have aspects that are very different from native C++, but the generator syntax can be very uncluttered. The set of pre-processor macros defined in this source allow generators defined with the syntax
3710:
import IO = XL.UI.CONSOLE iterator IntegerIterator (var out Counter : integer; Low, High : integer) written Counter in Low..High is Counter := Low while Counter <= High loop yield Counter += 1 // Note that I needs not be declared, because declared 'var
1991:
which walks down the list and stops on the first element that doesn't satisfy the predicate. If the list has been walked before until that point, it is just a strict data structure, but if any part hadn't been walked through before, it will be generated on demand. List comprehensions can be freely
292:
In the presence of generators, loop constructs of a language – such as for and while – can be reduced into a single loop ... end loop construct; all the usual loop constructs can then be comfortably simulated by using suitable generators in the right way. For example, a ranged loop like
393:
string_chars = iter (s: string) yields (char); index: int := 1; limit: int := string$ size (s); while index <= limit do yield (string$ fetch(s, index)); index := index + 1; end; end string_chars; for c: char in string_chars(s) do ... end;
251:
action, at which time the innermost loop enclosing the generator invocation is terminated. In more complicated situations, a generator may be used manually outside of a loop to create an iterator, which can then be used in various ways.
2136:
Some sequences are implemented imperatively (with private state variables) and some are implemented as (possibly infinite) lazy lists. Also, new struct definitions can have a property that specifies how they can be used as sequences.
2273:
Note that the Racket core implements powerful continuation features, providing general (re-entrant) continuations that are composable, and also delimited continuations. Using this, the generator library is implemented in Racket.
203:. Generators, also known as semicoroutines, are a special case of (and weaker than) coroutines, in that they always yield control back to the caller (when passing a value back), rather than specifying a coroutine to jump to; see 3459:
is available since C# version 2.0): Both of these examples utilize generics, but this is not required. yield keyword also helps in implementing custom stateful iterations over a collection as discussed in this discussion.
172:, 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 235:
action is used as the value of the invocation expression. The next time the same generator invocation is reached in a subsequent iteration, the execution of the generator's body is resumed after the
2817:
Java has had a standard interface for implementing iterators since its early days, and since Java 5, the "foreach" construction makes it easy to loop over objects that provide the
4173:, called a generator expression that aids in the creation of generators. The following extends the first example above by using a generator expression to compute squares from the 403:
Every expression (including loops) is a generator. The language has many generators built-in and even implements some of the logic semantics using the generator mechanism (
57: 5391: 5201:
utilizes generators to implement its goal directed evaluation. In Icon, generators can be invoked in contexts outside of the normal looping control structures.
262:
When eager evaluation is desirable (primarily when the sequence is finite, as otherwise evaluation will never terminate), one can either convert to a
3711:
out' in the iterator // An implicit declaration of I as an integer is therefore made here for I in 1..5 loop IO.WriteLn "I=", I
528:, it is simple to implement them using any framework that implements stackful coroutines, such as libdill. On POSIX platforms, when the cost of 513:
However, most of the time custom generators are implemented with the "suspend" keyword which functions exactly like the "yield" keyword in CLU.
5215: 5175: 104: 259:, such as sequences that would be expensive or impossible to compute at once. These include e.g. infinite sequences and live data streams. 76: 83: 1387:
Example parallel to Icon uses Raku (formerly/aka Perl 6) Range class as one of several ways to achieve generators with the language.
5481: 123: 169: 90: 5476: 161: 3726: 1620: 537: 334: 61: 223:
is created that encapsulates the state of the generator routine at its beginning, with arguments bound to the corresponding
374: 72: 3819: 2031: 330: 279: 224: 2140:
But more directly, Racket comes with a generator library for a more traditional generator specification. For example,
5198: 338: 326: 3810:
forms a sequence of squares of numbers from 0 to 14 by filtering out numbers from the range of numbers from 0 to 25.
4154:
statement is reached. The generator's frame is then frozen again, and the yielded value is returned to the caller.
2822: 322: 28: 50: 3703: 1438:
However, most of the time custom generators are implemented with "gather" and "take" keywords in a lazy context.
263: 220: 266:, or use a parallel construction that creates a list instead of a generator. For example, in Python a generator 5067: 521: 97: 5433: 4878:
generator below returns to each invocation 'goldenRatio next' a better approximation to the Golden Ratio.
5303: 165: 176:
and allows the caller to get started processing the first few values immediately. In short, a generator
1628: 216: 4161:
expression, allowing a generator to delegate part of its operations to another generator or iterable.
812:
functions. It's then possible to write generator-like classes by defining both the iterable methods (
378: 5308: 4150:
is called on the iterator, Python resumes the frozen frame, which executes normally until the next
3731: 3721: 2658:
Ruby supports generators (starting from version 1.9) in the form of the built-in Enumerator class.
404: 5222: 373:
standard does not natively provide generators, yet various library implementations exist, such as
5321: 5280: 5079: 4170: 533: 256: 255:
Because generators compute their yielded values only on demand, they are useful for representing
5171: 529: 5294:
Liskov, B.; Snyder, A.; Atkinson, R.; Schaffert, C. (1977). "Abstraction mechanisms in CLU".
5313: 219:
inside loops. The first time that a generator invocation is reached in a loop, an iterator
137: 17: 3736:
since version 1.9.1. These can define a sequence (lazily evaluated, sequential access) via
5450: 5097: 1624: 173: 2034:
provides several related facilities for generators. First, its for-loop forms work with
227:. The generator's body is then executed in the context of that iterator until a special 5462: 5353: 5268: 524:
does not have generator functions as a language construct, but, as they are a subset of
5211: 545: 5150: 389:
A yield statement is used to implement iterators over user-defined data abstractions.
5470: 5325: 2825:
and other collections frameworks, typically provide iterators for all collections.)
5118: 4875: 801: 200: 192: 153: 3986:"""Generate prime numbers indefinitely as needed.""" 5165: 832:) in the same class. For example, it is possible to write the following program: 5103: 4143: 540:
is desired, a very simple generator function framework can be implemented using
370: 39: 4279: 1918:
operator, used for parenthesization. This uses the standard adaptor function,
1215: 525: 350: 346: 145: 410:
Printing squares from 0 to 20 can be achieved using a co-routine by writing:
5410: 5257: 5253: 5249: 5112: 1451: 204: 196: 149: 5317: 4285:
An infinite Fibonacci sequence can be written using a function generator:
1214:
Perl does not natively provide generators, but support is provided by the
5091: 5085: 4139: 3959:# Another generator, which produces prime numbers indefinitely as needed. 541: 185: 157: 2286:
implemented generators in PHP 5.5. Details can be found in the original
797: 5421: 5367: 5137: 2287: 5454: 4019:# If dividing n by all the numbers in p, up to and including sqrt(n), 325:(1975), were a prominent feature in the string manipulation language 297:
can be implemented as iteration through a generator, as in Python's
247:
action, execution of the generator body can also be terminated by a
5453:, David Stoutamire and Clemens Szyperski: Iteration abstraction in 1219: 4868: 1506:# Finish the loop of the caller using a 'break' exception 231:
action is encountered; at that time, the value provided with the
3597:
statements and they are applied in sequence on each iteration:
2283: 1447: 353:), and other languages. In CLU and C#, generators are called 342: 33: 1525:# Use a simple 'for' loop to do the actual generation 3081:// Save the iterator of a stream that generates fib sequence 5138:
What is the difference between an Iterator and a Generator?
3465:// Method that takes an iterable input (possibly an array) 1390:
Printing squares from 0 to 20 can be achieved by writing:
191:
Generators can be implemented in terms of more expressive
5088:
for the concept of producing a list one element at a time
5082:
for another construct that generates a sequence of values
5032:
The expression below returns the next 10 approximations.
607:// will emit int values. Start of body of the generator. 3896:# Note that this iteration terminates normally, despite 3893:# Example use: printing out the integers from 10 to 20. 673:// stop, end of sequence. End of body of the generator. 5106:
for potentially infinite data by recursion instead of
3746:
that contain code that generates values. For example,
1631:
data constructor is generated on demand. For example,
1594:# Pull values from the generator until it is exhausted 5459:
ACM Transactions on Programming Languages and Systems
5339: 4792:
The iterators package can be used for this purpose.
3743:
or an array (eagerly evaluated, indexed access) via
3740:, a list (eagerly evaluated, sequential access) via 592:// from $ emit to $ stop is a body of our generator: 1491:# Produce the result of , the name of the generator 1272:# New generator which can be called like a coderef. 932:A basic range implementation would look like that: 64:. Unsourced material may be challenged and removed. 5411:PEP 380 -- Syntax for Delegating to a Subgenerator 4282:(a.k.a. Harmony) introduced generator functions. 2650:statement is automatically a generator function. 2075:and these sequences are also first-class values: 1450:8.6, the generator mechanism is founded on named 5151:"General ways to traverse collections in Scheme" 4022:# produces a non-zero remainder then n is prime. 3899:# countfrom() being written as an infinite loop. 3046:super-interface BaseStream of Stream interface. 586:// place the constructor of our generator, e.g. 4138:In Python, a generator can be thought of as an 286:evaluates lazily (a generator or sequence) but 3822:in version 2.2 in 2001. An example generator: 4157:PEP 380 (implemented in Python 3.3) adds the 804:to be applied to any class that provides the 8: 5392:"Some Details on F# Computation Expressions" 5115:for even more generalization from subroutine 755:// "get next" generator invocation 5368:"What is the yield keyword used for in C#?" 5258:PEP 342: Coroutines via Enhanced Generators 243:action is encountered. In addition to the 29:Generator (disambiguation) § Computing 3706:, iterators are the basis of 'for' loops: 5307: 4425:// generator without an upper bound limit 124:Learn how and when to remove this message 5244: 5242: 532:per iteration is not a concern, or full 205:comparison of coroutines with generators 5130: 4169:Python has a syntax modeled on that of 2199:; infinite sequence of integers from 0 1245:# Enable generator { BLOCK } and yield 1222:co-routine framework. Example usage: 3321:"done with first iteration" 2663:# Generator from an Enumerator object 664:// returns next number in , reversed. 73:"Generator" computer programming 7: 589:// descent(int minv, int maxv) {...} 62:adding citations to reliable sources 5281:"PHP: Generators overview - Manual" 160:. A generator is very similar to a 5121:for generalization of control flow 4713:// picks up from where you stopped 2038:, which are a kind of a producer: 1906:is a non-strict list constructor, 1627:model, every datum created with a 25: 3455:An example C# 2.0 generator (the 1257:# Array reference to iterate over 681:This can then be iterated using: 5167:Encyclopedia of computer science 5100:for producing values when needed 5068:A hidden gem in Pharo: Generator 3468:// and returns all even numbers. 2288:Request for Comments: Generators 329:(1977) and are now available in 309:to the generator and then using 148:that can be used to control the 38: 5149:Kiselyov, Oleg (January 2004). 3593:It is possible to use multiple 2465:Fibonacci sequence with limit: 49:needs additional citations for 5340:"Structured Concurrency for C" 5254:PEP 289: Generator Expressions 5248:Python Enhancement Proposals: 2646:Any function which contains a 1344:# Call the generator 15 times. 1326:# get next letter from $ chars 661:// similar to yield in Python, 305:can be implemented as sending 1: 3222:// Print the first 5 elements 2293:Infinite Fibonacci sequence: 557:as in the following example: 321:Generators first appeared in 4809:# Example ------------------ 4371:// bounded by upper limit 10 3327:// Print the next 5 elements 3042:Or get an Iterator from the 820:) and the iterator methods ( 289:evaluates eagerly (a list). 18:Generator (computer science) 407:or "OR" is done this way). 270:can be evaluated to a list 5498: 5434:"Infinite generators in R" 5250:PEP 255: Simple Generators 3719: 2823:Java collections framework 239:action, until yet another 168:, in that a generator has 156:. All generators are also 26: 5296:Communications of the ACM 5199:Icon Programming Language 3818:Generators were added to 3430:done with first iteration 3105:// Generates Fib sequence 5482:Iteration in programming 5422:Generator functions in R 5164:Anthony Ralston (2000). 5034: 4880: 4794: 4287: 4179: 3824: 3748: 3729:provides generators via 3708: 3599: 3462: 3412: 3048: 2827: 2714:# Generator from a block 2660: 2467: 2295: 2142: 2077: 2040: 2018:squaresForNumbersUnder20 1994: 1920: 1633: 1456: 1392: 1224: 934: 834: 683: 559: 412: 391: 282:the sequence expression 4142:that contains a frozen 2268:; -> '(10 11 12) 764:"next number is %d 377:documented in CLtL2 or 215:Generators are usually 5477:Programming constructs 1218:module which uses the 5318:10.1145/359763.359789 5170:. Nature Pub. Group. 4497:// manually iterating 4165:Generator expressions 3720:Further information: 1096:// Iterator functions 1021:// Iterable functions 299:for x in range(1, 10) 5461:, 18(1):1-15 (1996) 5356:. 21 September 2008. 5269:yield (C# Reference) 4177:generator function: 3732:sequence expressions 3659:"New York" 195:constructs, such as 58:improve this article 27:For other uses, see 5354:"Generators in C++" 4171:list comprehensions 3722:Sequence expression 1497:# Do the generation 536:rather than merely 405:logical disjunction 5216:"A History of CLU" 5094:for an alternative 5080:List comprehension 3683:"London" 2819:java.lang.Iterable 5451:Stephen Omohundro 5436:. 5 January 2013. 5372:stackoverflow.com 5177:978-1-56159-248-7 3671:"Paris" 2282:The community of 530:context switching 134: 133: 126: 108: 16:(Redirected from 5489: 5438: 5437: 5430: 5424: 5419: 5413: 5408: 5402: 5401: 5399: 5398: 5388: 5382: 5381: 5379: 5378: 5364: 5358: 5357: 5350: 5344: 5343: 5336: 5330: 5329: 5311: 5291: 5285: 5284: 5277: 5271: 5266: 5260: 5246: 5237: 5236: 5234: 5233: 5227: 5221:. Archived from 5220: 5208: 5202: 5195: 5189: 5188: 5186: 5184: 5161: 5155: 5154: 5146: 5140: 5135: 5062: 5058: 5054: 5051: 5048: 5044: 5041: 5038: 5028: 5025: 5022: 5019: 5015: 5011: 5008: 5005: 5002: 4999: 4996: 4993: 4990: 4987: 4984: 4981: 4978: 4975: 4971: 4968: 4965: 4961: 4958: 4955: 4952: 4949: 4946: 4943: 4940: 4936: 4933: 4930: 4927: 4924: 4921: 4918: 4915: 4912: 4909: 4906: 4903: 4900: 4897: 4893: 4890: 4887: 4884: 4858: 4855: 4852: 4849: 4846: 4843: 4840: 4837: 4834: 4831: 4828: 4825: 4822: 4819: 4816: 4813: 4810: 4807: 4804: 4801: 4798: 4783: 4780: 4777: 4774: 4771: 4768: 4765: 4762: 4759: 4756: 4753: 4750: 4747: 4744: 4741: 4738: 4735: 4732: 4729: 4726: 4723: 4720: 4717: 4714: 4711: 4708: 4705: 4702: 4699: 4696: 4693: 4690: 4687: 4684: 4681: 4678: 4675: 4672: 4669: 4666: 4663: 4660: 4657: 4654: 4651: 4648: 4645: 4642: 4639: 4636: 4633: 4630: 4627: 4624: 4621: 4618: 4615: 4612: 4609: 4606: 4603: 4600: 4597: 4594: 4591: 4588: 4585: 4582: 4579: 4576: 4573: 4570: 4567: 4564: 4561: 4558: 4555: 4552: 4549: 4546: 4543: 4540: 4537: 4534: 4531: 4528: 4525: 4522: 4519: 4516: 4513: 4510: 4507: 4504: 4501: 4498: 4495: 4492: 4489: 4486: 4483: 4480: 4477: 4474: 4471: 4468: 4465: 4462: 4459: 4456: 4453: 4450: 4447: 4444: 4441: 4438: 4435: 4432: 4429: 4426: 4423: 4420: 4417: 4414: 4411: 4408: 4405: 4402: 4399: 4396: 4393: 4390: 4387: 4384: 4381: 4378: 4375: 4372: 4369: 4366: 4363: 4360: 4357: 4354: 4351: 4348: 4345: 4342: 4339: 4336: 4333: 4330: 4327: 4324: 4321: 4318: 4315: 4312: 4309: 4306: 4303: 4300: 4297: 4294: 4291: 4270: 4267: 4264: 4261: 4258: 4255: 4252: 4249: 4246: 4243: 4240: 4237: 4234: 4231: 4228: 4225: 4222: 4219: 4216: 4213: 4210: 4207: 4204: 4201: 4198: 4195: 4192: 4189: 4186: 4183: 4176: 4160: 4153: 4149: 4134: 4131: 4128: 4125: 4122: 4119: 4116: 4113: 4110: 4107: 4104: 4101: 4098: 4095: 4092: 4089: 4086: 4083: 4080: 4077: 4074: 4071: 4068: 4065: 4062: 4059: 4056: 4053: 4050: 4047: 4044: 4041: 4038: 4035: 4032: 4029: 4026: 4023: 4020: 4017: 4014: 4011: 4008: 4005: 4002: 3999: 3996: 3993: 3990: 3987: 3984: 3981: 3978: 3975: 3972: 3969: 3966: 3963: 3960: 3957: 3954: 3951: 3948: 3945: 3942: 3939: 3936: 3933: 3930: 3927: 3924: 3921: 3918: 3915: 3912: 3909: 3906: 3903: 3900: 3897: 3894: 3891: 3888: 3885: 3882: 3879: 3876: 3873: 3870: 3867: 3864: 3861: 3858: 3855: 3852: 3849: 3846: 3843: 3840: 3837: 3834: 3831: 3828: 3806: 3803: 3800: 3797: 3794: 3791: 3788: 3785: 3782: 3779: 3776: 3773: 3770: 3767: 3764: 3761: 3758: 3755: 3752: 3745: 3742: 3739: 3693: 3690: 3687: 3684: 3681: 3678: 3675: 3672: 3669: 3666: 3663: 3660: 3657: 3654: 3651: 3648: 3645: 3642: 3639: 3636: 3633: 3630: 3627: 3624: 3621: 3618: 3615: 3612: 3609: 3606: 3603: 3596: 3589: 3586: 3583: 3580: 3577: 3574: 3571: 3568: 3565: 3562: 3559: 3556: 3553: 3550: 3547: 3544: 3541: 3538: 3535: 3532: 3529: 3526: 3523: 3520: 3517: 3514: 3511: 3508: 3505: 3502: 3499: 3496: 3493: 3490: 3487: 3484: 3481: 3478: 3475: 3472: 3469: 3466: 3458: 3446: 3443: 3440: 3437: 3434: 3431: 3428: 3425: 3422: 3419: 3416: 3406: 3403: 3400: 3397: 3394: 3391: 3388: 3385: 3382: 3379: 3376: 3373: 3370: 3367: 3364: 3361: 3358: 3355: 3352: 3349: 3346: 3343: 3340: 3337: 3334: 3331: 3328: 3325: 3322: 3319: 3316: 3313: 3310: 3307: 3304: 3301: 3298: 3295: 3292: 3289: 3286: 3283: 3280: 3277: 3274: 3271: 3268: 3265: 3262: 3259: 3256: 3253: 3250: 3247: 3244: 3241: 3238: 3235: 3232: 3229: 3226: 3223: 3220: 3217: 3214: 3211: 3208: 3205: 3202: 3199: 3196: 3193: 3190: 3187: 3184: 3181: 3178: 3175: 3172: 3169: 3166: 3163: 3160: 3157: 3154: 3151: 3148: 3145: 3142: 3139: 3136: 3133: 3130: 3127: 3124: 3121: 3118: 3115: 3112: 3109: 3106: 3103: 3100: 3097: 3094: 3091: 3088: 3085: 3082: 3079: 3076: 3073: 3070: 3067: 3064: 3061: 3058: 3055: 3052: 3038: 3035: 3032: 3029: 3026: 3023: 3020: 3017: 3014: 3011: 3008: 3005: 3002: 2999: 2996: 2993: 2990: 2987: 2984: 2981: 2978: 2975: 2972: 2969: 2966: 2963: 2960: 2957: 2954: 2951: 2948: 2945: 2942: 2939: 2936: 2933: 2930: 2927: 2924: 2921: 2918: 2915: 2912: 2909: 2906: 2903: 2900: 2897: 2894: 2891: 2888: 2885: 2882: 2879: 2876: 2873: 2870: 2867: 2864: 2861: 2858: 2855: 2852: 2849: 2846: 2843: 2840: 2837: 2834: 2831: 2821:interface. (The 2820: 2808: 2805: 2802: 2799: 2796: 2793: 2790: 2787: 2784: 2781: 2778: 2775: 2772: 2769: 2766: 2763: 2760: 2757: 2754: 2751: 2748: 2745: 2742: 2739: 2736: 2733: 2730: 2727: 2724: 2721: 2718: 2715: 2712: 2709: 2706: 2703: 2700: 2697: 2694: 2691: 2688: 2685: 2682: 2679: 2676: 2673: 2670: 2667: 2664: 2649: 2642: 2639: 2636: 2633: 2630: 2627: 2624: 2621: 2618: 2615: 2612: 2609: 2606: 2603: 2600: 2597: 2594: 2591: 2588: 2585: 2582: 2579: 2576: 2573: 2570: 2567: 2564: 2561: 2558: 2555: 2552: 2549: 2546: 2543: 2540: 2537: 2534: 2531: 2528: 2525: 2522: 2519: 2516: 2513: 2510: 2507: 2504: 2501: 2498: 2495: 2492: 2489: 2486: 2483: 2480: 2477: 2474: 2471: 2461: 2458: 2455: 2452: 2449: 2446: 2443: 2440: 2437: 2434: 2431: 2428: 2425: 2422: 2419: 2416: 2413: 2410: 2407: 2404: 2401: 2398: 2395: 2392: 2389: 2386: 2383: 2380: 2377: 2374: 2371: 2368: 2365: 2362: 2359: 2356: 2353: 2350: 2347: 2344: 2341: 2338: 2335: 2332: 2329: 2326: 2323: 2320: 2317: 2314: 2311: 2308: 2305: 2302: 2299: 2269: 2266: 2263: 2260: 2257: 2254: 2251: 2248: 2245: 2242: 2239: 2236: 2233: 2230: 2227: 2224: 2221: 2218: 2215: 2212: 2209: 2206: 2203: 2200: 2197: 2194: 2191: 2188: 2185: 2182: 2179: 2176: 2173: 2170: 2167: 2164: 2161: 2158: 2157:racket/generator 2155: 2152: 2149: 2146: 2132: 2129: 2126: 2123: 2120: 2117: 2114: 2111: 2108: 2105: 2102: 2099: 2096: 2093: 2090: 2087: 2084: 2081: 2071: 2068: 2065: 2062: 2059: 2056: 2053: 2050: 2047: 2044: 2022: 2019: 2016: 2013: 2010: 2007: 2004: 2001: 1998: 1987: 1984: 1981: 1978: 1975: 1972: 1969: 1966: 1963: 1960: 1957: 1954: 1951: 1948: 1945: 1942: 1939: 1936: 1933: 1930: 1927: 1924: 1913: 1905: 1898: 1895: 1892: 1889: 1886: 1883: 1880: 1877: 1874: 1871: 1868: 1865: 1862: 1859: 1856: 1853: 1850: 1847: 1844: 1841: 1838: 1835: 1832: 1829: 1826: 1823: 1820: 1817: 1814: 1811: 1808: 1805: 1802: 1799: 1796: 1793: 1790: 1787: 1784: 1781: 1778: 1775: 1772: 1769: 1766: 1763: 1760: 1757: 1754: 1751: 1748: 1745: 1742: 1739: 1736: 1733: 1730: 1727: 1724: 1721: 1718: 1715: 1712: 1709: 1706: 1703: 1700: 1697: 1694: 1691: 1688: 1685: 1682: 1679: 1676: 1673: 1670: 1667: 1664: 1661: 1658: 1655: 1652: 1649: 1646: 1643: 1640: 1637: 1610: 1607: 1604: 1601: 1598: 1595: 1592: 1589: 1586: 1583: 1580: 1577: 1573: 1570: 1567: 1564: 1561: 1558: 1555: 1552: 1549: 1545: 1542: 1539: 1536: 1533: 1529: 1526: 1523: 1520: 1517: 1513: 1510: 1507: 1504: 1501: 1498: 1495: 1492: 1489: 1486: 1483: 1480: 1476: 1473: 1470: 1467: 1464: 1460: 1433: 1430: 1426: 1422: 1419: 1416: 1412: 1408: 1404: 1400: 1396: 1378: 1375: 1372: 1369: 1366: 1363: 1360: 1357: 1354: 1351: 1348: 1345: 1342: 1339: 1336: 1333: 1330: 1327: 1324: 1321: 1318: 1315: 1312: 1309: 1306: 1303: 1300: 1297: 1294: 1291: 1288: 1285: 1282: 1279: 1276: 1273: 1270: 1267: 1264: 1261: 1258: 1255: 1252: 1249: 1246: 1243: 1240: 1237: 1234: 1231: 1228: 1205: 1202: 1199: 1196: 1193: 1190: 1187: 1184: 1181: 1178: 1175: 1172: 1169: 1166: 1163: 1160: 1157: 1154: 1151: 1148: 1145: 1142: 1139: 1136: 1133: 1130: 1127: 1124: 1121: 1118: 1115: 1112: 1109: 1106: 1103: 1100: 1097: 1094: 1091: 1088: 1085: 1082: 1079: 1076: 1073: 1070: 1067: 1064: 1061: 1058: 1055: 1052: 1049: 1046: 1043: 1040: 1037: 1034: 1031: 1028: 1025: 1022: 1019: 1016: 1013: 1010: 1007: 1004: 1001: 998: 995: 992: 989: 986: 983: 980: 977: 974: 971: 968: 965: 962: 959: 956: 953: 950: 947: 944: 941: 938: 928: 925: 922: 919: 916: 913: 910: 907: 904: 901: 898: 895: 892: 889: 886: 883: 880: 877: 874: 871: 868: 865: 862: 859: 856: 853: 850: 847: 844: 841: 840:<iostream> 838: 831: 827: 823: 819: 815: 811: 807: 792: 789: 786: 783: 780: 777: 774: 771: 768: 765: 762: 759: 756: 753: 750: 747: 744: 741: 738: 735: 732: 729: 726: 723: 720: 717: 714: 711: 708: 705: 702: 699: 696: 693: 690: 687: 677: 674: 671: 668: 665: 662: 659: 656: 653: 650: 647: 644: 641: 638: 635: 632: 629: 626: 623: 620: 617: 614: 611: 608: 605: 602: 599: 596: 593: 590: 587: 584: 581: 578: 575: 572: 569: 566: 563: 509: 506: 503: 500: 497: 494: 491: 488: 485: 482: 479: 476: 473: 470: 467: 464: 461: 458: 455: 452: 449: 446: 443: 440: 437: 434: 431: 428: 425: 422: 419: 416: 312: 304: 300: 296: 288: 285: 277: 273: 269: 164:that returns an 138:computer science 129: 122: 118: 115: 109: 107: 66: 42: 34: 21: 5497: 5496: 5492: 5491: 5490: 5488: 5487: 5486: 5467: 5466: 5449:Stephan Murer, 5446: 5441: 5432: 5431: 5427: 5420: 5416: 5409: 5405: 5396: 5394: 5390: 5389: 5385: 5376: 5374: 5366: 5365: 5361: 5352: 5351: 5347: 5338: 5337: 5333: 5293: 5292: 5288: 5279: 5278: 5274: 5267: 5263: 5247: 5240: 5231: 5229: 5225: 5218: 5212:Liskov, Barbara 5210: 5209: 5205: 5196: 5192: 5182: 5180: 5178: 5163: 5162: 5158: 5148: 5147: 5143: 5136: 5132: 5128: 5098:Lazy evaluation 5076: 5064: 5063: 5060: 5056: 5052: 5049: 5046: 5042: 5039: 5036: 5030: 5029: 5026: 5023: 5020: 5017: 5013: 5009: 5006: 5003: 5000: 4997: 4994: 4991: 4988: 4985: 4982: 4979: 4976: 4973: 4969: 4966: 4963: 4959: 4956: 4953: 4950: 4947: 4944: 4941: 4938: 4934: 4931: 4928: 4925: 4922: 4919: 4916: 4913: 4910: 4907: 4904: 4901: 4898: 4895: 4891: 4888: 4885: 4882: 4869:Pharo Smalltalk 4865: 4860: 4859: 4856: 4853: 4850: 4847: 4844: 4841: 4838: 4835: 4832: 4829: 4826: 4823: 4820: 4817: 4814: 4811: 4808: 4805: 4802: 4799: 4796: 4790: 4785: 4784: 4781: 4778: 4775: 4772: 4769: 4766: 4763: 4760: 4757: 4754: 4751: 4748: 4745: 4742: 4739: 4736: 4733: 4730: 4727: 4724: 4721: 4718: 4715: 4712: 4709: 4706: 4703: 4700: 4697: 4694: 4691: 4688: 4685: 4682: 4679: 4676: 4673: 4670: 4667: 4664: 4661: 4658: 4655: 4652: 4649: 4646: 4643: 4640: 4637: 4634: 4631: 4628: 4625: 4622: 4619: 4616: 4613: 4610: 4607: 4604: 4601: 4598: 4595: 4592: 4589: 4586: 4583: 4580: 4577: 4574: 4571: 4568: 4565: 4562: 4559: 4556: 4553: 4550: 4547: 4544: 4541: 4538: 4535: 4532: 4529: 4526: 4523: 4520: 4517: 4514: 4511: 4508: 4505: 4502: 4499: 4496: 4493: 4490: 4487: 4484: 4481: 4478: 4475: 4472: 4469: 4466: 4463: 4460: 4457: 4454: 4451: 4448: 4445: 4442: 4439: 4436: 4433: 4430: 4427: 4424: 4421: 4418: 4415: 4412: 4409: 4406: 4403: 4400: 4397: 4394: 4391: 4388: 4385: 4382: 4379: 4376: 4373: 4370: 4367: 4364: 4361: 4358: 4355: 4352: 4349: 4346: 4343: 4340: 4337: 4334: 4331: 4328: 4325: 4322: 4319: 4316: 4313: 4310: 4307: 4304: 4301: 4298: 4295: 4292: 4289: 4277: 4272: 4271: 4268: 4265: 4262: 4259: 4256: 4253: 4250: 4247: 4244: 4241: 4238: 4235: 4232: 4229: 4226: 4223: 4220: 4217: 4214: 4211: 4208: 4205: 4202: 4199: 4196: 4193: 4190: 4187: 4184: 4181: 4174: 4167: 4158: 4151: 4147: 4136: 4135: 4132: 4129: 4126: 4123: 4120: 4117: 4114: 4111: 4108: 4105: 4102: 4099: 4096: 4093: 4090: 4087: 4084: 4081: 4078: 4075: 4072: 4069: 4066: 4063: 4060: 4057: 4054: 4051: 4048: 4045: 4042: 4039: 4036: 4033: 4030: 4027: 4024: 4021: 4018: 4015: 4012: 4009: 4006: 4003: 4000: 3997: 3994: 3991: 3988: 3985: 3982: 3979: 3976: 3973: 3970: 3967: 3964: 3961: 3958: 3955: 3952: 3949: 3946: 3943: 3940: 3937: 3934: 3931: 3928: 3925: 3922: 3919: 3916: 3913: 3910: 3907: 3904: 3901: 3898: 3895: 3892: 3889: 3886: 3883: 3880: 3877: 3874: 3871: 3868: 3865: 3862: 3859: 3856: 3853: 3850: 3847: 3844: 3841: 3838: 3835: 3832: 3829: 3826: 3816: 3808: 3807: 3804: 3801: 3798: 3795: 3792: 3789: 3786: 3783: 3780: 3777: 3774: 3771: 3768: 3765: 3762: 3759: 3756: 3753: 3750: 3744: 3741: 3737: 3724: 3718: 3713: 3712: 3700: 3695: 3694: 3691: 3688: 3685: 3682: 3679: 3676: 3673: 3670: 3667: 3664: 3661: 3658: 3655: 3652: 3649: 3646: 3643: 3640: 3637: 3634: 3631: 3628: 3625: 3622: 3619: 3616: 3613: 3610: 3607: 3604: 3601: 3594: 3591: 3590: 3587: 3584: 3581: 3578: 3575: 3572: 3569: 3566: 3563: 3560: 3557: 3554: 3551: 3548: 3545: 3542: 3539: 3536: 3533: 3530: 3527: 3524: 3521: 3518: 3515: 3512: 3509: 3506: 3503: 3500: 3497: 3494: 3491: 3488: 3485: 3482: 3479: 3476: 3473: 3470: 3467: 3464: 3456: 3453: 3448: 3447: 3444: 3441: 3438: 3435: 3432: 3429: 3426: 3423: 3420: 3417: 3414: 3408: 3407: 3404: 3401: 3398: 3395: 3392: 3389: 3386: 3383: 3380: 3377: 3374: 3371: 3368: 3365: 3362: 3359: 3356: 3353: 3350: 3347: 3344: 3341: 3338: 3335: 3332: 3329: 3326: 3323: 3320: 3317: 3314: 3311: 3308: 3305: 3302: 3299: 3296: 3293: 3290: 3287: 3284: 3281: 3278: 3275: 3272: 3269: 3266: 3263: 3260: 3257: 3254: 3251: 3248: 3245: 3242: 3239: 3236: 3233: 3230: 3227: 3224: 3221: 3218: 3215: 3212: 3209: 3206: 3203: 3200: 3197: 3194: 3191: 3188: 3185: 3182: 3179: 3176: 3173: 3170: 3167: 3164: 3161: 3158: 3155: 3152: 3149: 3146: 3143: 3140: 3137: 3134: 3131: 3128: 3125: 3122: 3119: 3116: 3113: 3110: 3107: 3104: 3101: 3098: 3095: 3092: 3089: 3086: 3083: 3080: 3077: 3074: 3071: 3068: 3065: 3062: 3059: 3056: 3053: 3050: 3040: 3039: 3036: 3033: 3030: 3027: 3024: 3021: 3018: 3015: 3012: 3009: 3006: 3003: 3000: 2997: 2994: 2991: 2988: 2985: 2982: 2979: 2976: 2973: 2970: 2967: 2964: 2961: 2958: 2955: 2952: 2949: 2946: 2943: 2940: 2937: 2934: 2931: 2928: 2925: 2922: 2919: 2916: 2913: 2910: 2907: 2904: 2901: 2898: 2895: 2892: 2889: 2886: 2883: 2880: 2877: 2874: 2871: 2868: 2865: 2862: 2859: 2856: 2853: 2850: 2847: 2844: 2841: 2838: 2835: 2832: 2829: 2818: 2815: 2810: 2809: 2806: 2803: 2800: 2797: 2794: 2791: 2788: 2785: 2782: 2779: 2776: 2773: 2770: 2767: 2764: 2761: 2758: 2755: 2752: 2749: 2746: 2743: 2740: 2737: 2734: 2731: 2728: 2725: 2722: 2719: 2716: 2713: 2710: 2707: 2704: 2701: 2698: 2695: 2692: 2689: 2686: 2683: 2680: 2677: 2674: 2671: 2668: 2665: 2662: 2656: 2647: 2644: 2643: 2640: 2637: 2634: 2631: 2628: 2625: 2622: 2619: 2616: 2613: 2610: 2607: 2604: 2601: 2598: 2595: 2592: 2589: 2586: 2583: 2580: 2577: 2574: 2571: 2568: 2565: 2562: 2559: 2556: 2553: 2550: 2547: 2544: 2541: 2538: 2535: 2532: 2529: 2526: 2523: 2520: 2517: 2514: 2511: 2508: 2505: 2502: 2499: 2496: 2493: 2490: 2487: 2484: 2481: 2478: 2475: 2472: 2469: 2463: 2462: 2459: 2456: 2453: 2450: 2447: 2444: 2441: 2438: 2435: 2432: 2429: 2426: 2423: 2420: 2417: 2414: 2411: 2408: 2405: 2402: 2399: 2396: 2393: 2390: 2387: 2384: 2381: 2378: 2375: 2372: 2369: 2366: 2363: 2360: 2357: 2354: 2351: 2348: 2345: 2342: 2339: 2336: 2333: 2330: 2327: 2324: 2321: 2318: 2315: 2312: 2309: 2306: 2303: 2300: 2297: 2280: 2271: 2270: 2267: 2264: 2261: 2258: 2255: 2252: 2249: 2246: 2243: 2240: 2237: 2234: 2231: 2228: 2225: 2222: 2219: 2216: 2213: 2210: 2207: 2204: 2201: 2198: 2195: 2192: 2189: 2186: 2183: 2180: 2177: 2174: 2171: 2168: 2165: 2162: 2159: 2156: 2153: 2150: 2147: 2144: 2134: 2133: 2130: 2127: 2124: 2121: 2118: 2115: 2112: 2109: 2106: 2103: 2100: 2097: 2094: 2091: 2088: 2085: 2082: 2079: 2073: 2072: 2069: 2066: 2063: 2060: 2057: 2054: 2051: 2048: 2045: 2042: 2029: 2024: 2023: 2020: 2017: 2014: 2011: 2008: 2005: 2002: 1999: 1996: 1989: 1988: 1985: 1982: 1979: 1976: 1973: 1970: 1967: 1964: 1961: 1958: 1955: 1952: 1949: 1946: 1943: 1940: 1937: 1934: 1931: 1928: 1925: 1922: 1911: 1903: 1900: 1899: 1896: 1893: 1890: 1887: 1884: 1881: 1878: 1875: 1872: 1869: 1866: 1863: 1860: 1857: 1854: 1851: 1848: 1845: 1842: 1839: 1836: 1833: 1830: 1827: 1824: 1821: 1818: 1815: 1812: 1809: 1806: 1803: 1800: 1797: 1794: 1791: 1788: 1785: 1782: 1779: 1776: 1773: 1770: 1767: 1764: 1761: 1758: 1755: 1752: 1749: 1746: 1743: 1740: 1737: 1734: 1731: 1728: 1725: 1722: 1719: 1716: 1713: 1710: 1707: 1704: 1701: 1698: 1695: 1692: 1689: 1686: 1683: 1680: 1677: 1674: 1671: 1668: 1665: 1662: 1659: 1656: 1653: 1650: 1647: 1644: 1641: 1638: 1635: 1625:lazy evaluation 1617: 1612: 1611: 1608: 1605: 1602: 1599: 1596: 1593: 1590: 1587: 1584: 1581: 1578: 1575: 1571: 1568: 1565: 1562: 1559: 1556: 1553: 1550: 1547: 1543: 1540: 1537: 1534: 1531: 1527: 1524: 1521: 1518: 1515: 1511: 1508: 1505: 1502: 1499: 1496: 1493: 1490: 1487: 1484: 1481: 1478: 1474: 1471: 1468: 1465: 1462: 1458: 1444: 1436: 1435: 1431: 1428: 1424: 1420: 1417: 1414: 1410: 1406: 1402: 1398: 1394: 1385: 1380: 1379: 1376: 1373: 1370: 1367: 1364: 1361: 1358: 1355: 1352: 1349: 1346: 1343: 1340: 1337: 1334: 1331: 1328: 1325: 1322: 1319: 1316: 1313: 1310: 1307: 1304: 1301: 1298: 1295: 1292: 1289: 1286: 1283: 1280: 1277: 1274: 1271: 1268: 1265: 1262: 1259: 1256: 1253: 1251:Coro::Generator 1250: 1247: 1244: 1241: 1238: 1235: 1232: 1229: 1226: 1216:Coro::Generator 1212: 1207: 1206: 1203: 1200: 1197: 1194: 1191: 1188: 1185: 1182: 1179: 1176: 1173: 1170: 1167: 1164: 1161: 1158: 1155: 1152: 1149: 1146: 1143: 1140: 1137: 1134: 1131: 1128: 1125: 1122: 1119: 1116: 1113: 1110: 1107: 1104: 1101: 1098: 1095: 1092: 1089: 1086: 1083: 1080: 1077: 1074: 1071: 1068: 1065: 1062: 1059: 1056: 1053: 1050: 1047: 1044: 1041: 1038: 1035: 1032: 1029: 1026: 1023: 1020: 1017: 1014: 1011: 1008: 1005: 1002: 999: 996: 993: 990: 987: 984: 981: 978: 975: 972: 969: 966: 963: 960: 957: 954: 951: 948: 945: 942: 939: 936: 930: 929: 926: 923: 920: 917: 914: 911: 908: 905: 902: 899: 896: 893: 890: 887: 884: 881: 878: 875: 872: 869: 866: 863: 860: 857: 854: 851: 848: 845: 842: 839: 836: 829: 825: 821: 817: 813: 809: 805: 794: 793: 790: 787: 784: 781: 778: 775: 772: 769: 766: 763: 760: 757: 754: 751: 748: 745: 742: 739: 736: 733: 730: 727: 724: 721: 718: 715: 712: 709: 706: 703: 700: 697: 694: 691: 688: 685: 679: 678: 675: 672: 669: 666: 663: 660: 657: 654: 651: 648: 645: 642: 639: 636: 633: 630: 627: 624: 621: 618: 615: 612: 609: 606: 603: 600: 597: 594: 591: 588: 585: 582: 579: 576: 573: 570: 567: 564: 561: 554: 519: 511: 510: 507: 504: 501: 498: 495: 492: 489: 486: 483: 480: 477: 474: 471: 468: 465: 462: 459: 456: 453: 450: 447: 444: 441: 438: 435: 432: 429: 426: 423: 420: 417: 414: 401: 396: 395: 387: 367: 357:, and in Ruby, 319: 310: 302: 298: 295:for x = 1 to 10 294: 287: 283: 275: 271: 267: 213: 199:or first-class 180:a function but 152:behaviour of a 130: 119: 113: 110: 67: 65: 55: 43: 32: 23: 22: 15: 12: 11: 5: 5495: 5493: 5485: 5484: 5479: 5469: 5468: 5465: 5464: 5445: 5442: 5440: 5439: 5425: 5414: 5403: 5383: 5359: 5345: 5331: 5309:10.1.1.112.656 5302:(8): 564–576. 5286: 5272: 5261: 5238: 5214:(April 1992). 5203: 5190: 5176: 5156: 5141: 5129: 5127: 5124: 5123: 5122: 5116: 5110: 5101: 5095: 5089: 5083: 5075: 5072: 5035: 4881: 4864: 4861: 4795: 4789: 4786: 4288: 4276: 4273: 4180: 4166: 4163: 3825: 3815: 3812: 3749: 3717: 3714: 3709: 3699: 3696: 3608:CityCollection 3600: 3463: 3452: 3449: 3413: 3049: 2828: 2814: 2811: 2661: 2655: 2652: 2468: 2296: 2279: 2276: 2143: 2078: 2041: 2028: 2025: 1997:squaresUnder20 1995: 1921: 1634: 1616: 1613: 1457: 1443: 1440: 1393: 1384: 1381: 1359:"\n" 1225: 1211: 1208: 935: 835: 684: 560: 553: 550: 518: 515: 413: 400: 397: 392: 386: 383: 366: 363: 318: 315: 212: 209: 132: 131: 46: 44: 37: 24: 14: 13: 10: 9: 6: 4: 3: 2: 5494: 5483: 5480: 5478: 5475: 5474: 5472: 5463: 5460: 5456: 5452: 5448: 5447: 5443: 5435: 5429: 5426: 5423: 5418: 5415: 5412: 5407: 5404: 5393: 5387: 5384: 5373: 5369: 5363: 5360: 5355: 5349: 5346: 5341: 5335: 5332: 5327: 5323: 5319: 5315: 5310: 5305: 5301: 5297: 5290: 5287: 5282: 5276: 5273: 5270: 5265: 5262: 5259: 5255: 5251: 5245: 5243: 5239: 5228:on 2003-09-17 5224: 5217: 5213: 5207: 5204: 5200: 5194: 5191: 5179: 5173: 5169: 5168: 5160: 5157: 5152: 5145: 5142: 5139: 5134: 5131: 5125: 5120: 5117: 5114: 5111: 5109: 5105: 5102: 5099: 5096: 5093: 5090: 5087: 5084: 5081: 5078: 5077: 5073: 5071: 5069: 5033: 4879: 4877: 4872: 4870: 4862: 4793: 4787: 4286: 4283: 4281: 4274: 4178: 4172: 4164: 4162: 4155: 4145: 4141: 3823: 3821: 3813: 3811: 3747: 3735: 3733: 3728: 3723: 3715: 3707: 3705: 3697: 3644:GetEnumerator 3598: 3461: 3450: 3411: 3047: 3045: 2826: 2824: 2812: 2659: 2653: 2651: 2466: 2294: 2291: 2289: 2285: 2277: 2275: 2141: 2138: 2076: 2039: 2037: 2033: 2026: 1993: 1919: 1917: 1916:"called-with" 1909: 1632: 1630: 1626: 1622: 1614: 1455: 1453: 1449: 1441: 1439: 1391: 1388: 1382: 1223: 1221: 1217: 1209: 933: 833: 803: 802:foreach loops 799: 682: 558: 551: 549: 547: 543: 539: 535: 531: 527: 523: 516: 514: 411: 408: 406: 398: 390: 384: 382: 380: 376: 372: 364: 362: 360: 356: 352: 348: 344: 340: 336: 332: 328: 324: 316: 314: 313:in the loop. 308: 290: 281: 265: 260: 258: 253: 250: 246: 242: 238: 234: 230: 226: 222: 218: 210: 208: 206: 202: 201:continuations 198: 194: 189: 187: 183: 179: 175: 171: 167: 163: 159: 155: 151: 147: 143: 139: 128: 125: 117: 106: 103: 99: 96: 92: 89: 85: 82: 78: 75: –  74: 70: 69:Find sources: 63: 59: 53: 52: 47:This article 45: 41: 36: 35: 30: 19: 5458: 5428: 5417: 5406: 5395:. Retrieved 5386: 5375:. Retrieved 5371: 5362: 5348: 5334: 5299: 5295: 5289: 5275: 5264: 5230:. Retrieved 5223:the original 5206: 5193: 5181:. Retrieved 5166: 5159: 5144: 5133: 5119:Continuation 5107: 5066:See more in 5065: 5031: 4876:Golden ratio 4873: 4866: 4791: 4284: 4280:ECMAScript 6 4278: 4168: 4156: 4137: 3817: 3809: 3730: 3725: 3701: 3595:yield return 3592: 3454: 3409: 3043: 3041: 2816: 2657: 2645: 2464: 2292: 2281: 2272: 2139: 2135: 2119:"i = ~s 2074: 2058:"i = ~s 2035: 2030: 1990: 1915: 1907: 1901: 1819:notDivisible 1759:notDivisible 1618: 1445: 1437: 1389: 1386: 1213: 931: 795: 680: 555: 520: 512: 409: 402: 388: 368: 358: 354: 320: 306: 291: 261: 254: 248: 244: 240: 236: 232: 228: 214: 193:control flow 190: 182:behaves like 181: 177: 141: 135: 120: 111: 101: 94: 87: 80: 68: 56:Please help 51:verification 48: 5104:Corecursion 5021:goldenRatio 4883:goldenRatio 4867:Example in 4842:'c' 4836:'b' 4830:'a' 4146:. Whenever 4144:stack frame 3738:seq { ... } 3632:IEnumerator 3614:IEnumerable 3495:IEnumerable 3477:IEnumerable 3393:myGenerator 3288:myGenerator 3096:myGenerator 1623:, with its 562:$ generator 538:concurrency 534:parallelism 371:Common Lisp 359:enumerators 301:. Further, 284:seq { ... } 278:, while in 276:l = list(g) 5471:Categories 5444:References 5397:2007-12-14 5377:2018-01-01 5232:2006-01-05 4275:ECMAScript 4159:yield from 3010:myIterable 2872:myIterable 2723:Enumerator 2672:Enumerator 1914:is just a 1687:from10to20 1681:from10to20 1629:non-strict 1514:codebreak 1452:coroutines 826:operator++ 822:operator!= 796:Moreover, 526:coroutines 369:The final 351:ES6/ES2015 347:ECMAScript 225:parameters 197:coroutines 178:looks like 170:parameters 84:newspapers 5304:CiteSeerX 5113:Coroutine 5037:Character 4889:Generator 4863:Smalltalk 4803:iterators 4509:fibonacci 4443:fibonacci 4389:fibonacci 4296:fibonacci 4209:countfrom 4175:countfrom 4064:takewhile 4058:itertools 3965:itertools 3911:countfrom 3842:countfrom 2599:fibonacci 2491:Generator 2473:fibonacci 2421:fibonacci 2403:$ current 2388:$ current 2376:$ current 2364:$ current 2328:$ current 2310:Generator 2301:fibonacci 2226:ints-from 2184:generator 2172:ints-from 2036:sequences 2003:takeWhile 1983:otherwise 1971:takeWhile 1932:takeWhile 1923:takeWhile 1861:takeWhile 1801:nextPrime 1795:otherwise 1774:nextPrime 1750:nextPrime 1741:nextPrime 1711:countFrom 1693:takeWhile 1663:countFrom 1648:countFrom 1636:countFrom 1535:generator 1475:coroutine 1461:generator 1350:$ letters 1284:generator 1278:$ letters 830:operator* 355:iterators 158:iterators 150:iteration 142:generator 114:July 2007 5326:17343380 5092:Iteratee 5086:Iterator 5074:See also 5057:collect: 4908:x y z r 4848:nextElem 4290:function 4140:iterator 3980:Iterator 3863:Iterator 3836:Iterator 3410:Output: 3216:iterator 3084:Iterator 3004:iterator 2860:Iterable 2629:$ number 2614:$ number 2470:function 2442:$ number 2430:$ number 2298:function 2092:in-range 2086:10-to-20 1503:$ script 1477:genapply 1409:) -> 1332:$ letter 1317:@$ chars 1311:$ letter 1239:warnings 1177:operator 1150:operator 1102:operator 900:<< 894:<< 837:#include 542:pthreads 333:(2001), 317:Timeline 311:continue 186:iterator 162:function 4974:asFloat 4797:library 4740:console 4680:console 4647:console 4614:console 4581:console 4548:console 4515:console 4452:console 4404:console 4230:squares 4182:squares 3531:numbers 3516:foreach 3507:numbers 3489:GetEven 3387:println 3315:println 3282:println 3111:iterate 3090:Integer 3034:println 3016:forEach 2884:iterate 2866:Integer 2759:yielder 2738:yielder 2593:foreach 2539:$ limit 2482:$ limit 2415:foreach 2154:require 1642:Integer 1621:Haskell 1615:Haskell 1263:$ chars 946:private 800:allows 719:descent 649:$ yield 568:descent 472:squares 427:squares 418:squares 349:(as of 257:streams 217:invoked 146:routine 98:scholar 5455:Sather 5324:  5306:  5183:11 May 5174:  5014:repeat 5007:yield: 4937:[ 4731:fibGen 4692:fibGen 4659:fibGen 4626:fibGen 4593:fibGen 4560:fibGen 4527:fibGen 4503:fibGen 4148:next() 4115:append 4070:lambda 3971:primes 3962:import 3833:import 3830:typing 3820:Python 3814:Python 3680:return 3668:return 3656:return 3638:string 3629:public 3620:string 3602:public 3576:number 3573:return 3546:number 3525:number 3474:static 3471:public 3375:System 3303:System 3270:System 3102:Stream 3051:record 3044:Java 8 3022:System 2878:Stream 2830:record 2635:" 2626:" 2454:" 2448:" 2394:$ last 2382:$ last 2370:$ last 2316:$ last 2217:define 2166:define 2148:racket 2145:#lang 2125:" 2116:printf 2083:define 2064:" 2055:printf 2032:Racket 2027:Racket 1992:used: 1910:, and 1902:where 1897:primes 1723:primes 1717:primes 1519:$ body 1509:return 1482:script 1427:; 1413:{ 1405:(* ** 1401:.. *). 1230:strict 1192:return 1129:return 1081:return 1045:return 970:public 918:return 782:return 770:" 758:printf 667:$ stop 595:$ emit 433:create 375:SERIES 331:Python 307:finish 249:finish 221:object 174:memory 100:  93:  86:  79:  71:  5322:S2CID 5226:(PDF) 5219:(PDF) 5126:Notes 5108:yield 5043:join: 4815:<- 4776:break 4770:10000 4722:const 4704:value 4671:value 4638:value 4605:value 4572:value 4539:value 4488:break 4482:10000 4434:const 4380:const 4350:yield 4341:limit 4338:<= 4329:limit 4320:while 4302:limit 4269:break 4251:print 4242:<= 4152:yield 4103:yield 4088:<= 4010:while 3989:yield 3977:-> 3956:break 3938:print 3929:<= 3878:yield 3869:while 3860:-> 3793:yield 3677:yield 3665:yield 3653:yield 3605:class 3570:yield 3457:yield 3201:-> 3141:-> 2989:-> 2965:limit 2914:-> 2798:count 2789:times 2765:yield 2717:count 2702:chars 2693:times 2666:chars 2648:yield 2548:yield 2524:while 2497:yield 2400:yield 2349:while 2340:yield 2205:yield 2009:<= 1867:<= 1747:where 1699:<= 1645:-> 1597:while 1582:yield 1560:<= 1530:count 1494:yield 1423:> 1353:-> 1347:print 1329:yield 1186:const 1123:const 1117:& 1114:range 1111:const 1075:const 1066:& 1063:range 1060:const 1039:const 1033:begin 1030:& 1027:range 1024:const 976:range 940:range 937:class 870:range 814:begin 806:begin 798:C++11 546:pipes 508:break 493:write 484:<= 460:every 415:local 379:pygen 303:break 245:yield 241:yield 237:yield 233:yield 229:yield 166:array 144:is a 105:JSTOR 91:books 5197:The 5185:2013 5172:ISBN 5024:next 4874:The 4818:iter 4767:> 4710:// 8 4698:next 4677:// 5 4665:next 4644:// 3 4632:next 4611:// 2 4599:next 4578:// 1 4566:next 4545:// 1 4533:next 4479:> 4353:curr 4335:curr 4263:else 4043:> 4013:True 3950:else 3872:True 3827:from 3790:then 3784:< 3641:> 3635:< 3623:> 3617:< 3504:> 3498:< 3486:> 3480:< 3402:()); 3399:next 3354:< 3297:()); 3294:next 3249:< 3147:Pair 3120:Pair 3093:> 3087:< 3054:Pair 2920:Pair 2893:Pair 2869:> 2863:< 2833:Pair 2813:Java 2804:next 2795:puts 2753:loop 2708:next 2699:puts 2654:Ruby 2623:echo 2536:< 2439:echo 2355:true 2238:list 2211:)))) 2175:from 1908:cons 1894:tail 1606:puts 1572:incr 1544:{set 1500:eval 1466:body 1459:proc 1415:last 1383:Raku 1220:Coro 1210:Perl 1195:iter 1165:iter 1147:void 1138:last 1135:< 1132:iter 1099:bool 1087:this 1051:this 1006:iter 994:last 964:iter 955:last 909:endl 891:cout 846:main 828:and 816:and 808:and 710:argv 704:char 698:argc 689:main 631:> 544:and 505:else 490:then 399:Icon 365:Lisp 339:Ruby 327:Icon 274:via 264:list 211:Uses 154:loop 140:, a 77:news 5457:. 5314:doi 5050:to: 4892:on: 4854:abc 4812:abc 4746:log 4716:for 4701:(). 4686:log 4668:(). 4653:log 4635:(). 4620:log 4602:(). 4587:log 4569:(). 4554:log 4536:(). 4521:log 4512:(); 4500:let 4458:log 4446:()) 4428:for 4410:log 4374:for 4311:let 4221:for 4200:for 4100:)): 4049:for 4028:all 3968:def 3902:for 3854:int 3839:def 3757:for 3751:seq 3702:In 3522:int 3501:int 3483:int 3381:out 3336:int 3330:for 3309:out 3276:out 3231:int 3225:for 3219:(); 3192:map 3144:new 3117:new 3078:{}; 3069:int 3060:int 3028:out 3001:):: 2980:map 2917:new 2890:new 2857:{}; 2848:int 2839:int 2783:100 2780:end 2729:new 2678:new 2581:$ a 2572:$ b 2566:$ a 2560:$ b 2551:$ a 2533:$ i 2512:$ i 2506:$ b 2500:$ a 2479:int 2284:PHP 2278:PHP 2193:for 2107:for 2046:for 1904:(:) 1849:rem 1828:all 1619:In 1585:$ i 1557:$ i 1541:for 1528:set 1448:Tcl 1446:In 1442:Tcl 1432:$ i 1429:say 1421:$ i 1411:$ i 1403:map 1395:for 1362:for 1356:(), 1305:for 1293:$ i 1248:use 1236:use 1227:use 1174:int 1069:end 1000:end 985:end 982:int 961:int 952:int 903:std 885:std 861:int 855:for 843:int 818:end 810:end 752:);) 743:gen 734:int 728:for 722:gen 695:int 686:int 610:for 601:int 577:int 552:C++ 439:seq 385:CLU 343:PHP 323:CLU 184:an 136:In 60:by 5473:: 5370:. 5320:. 5312:. 5300:20 5298:. 5256:, 5252:, 5241:^ 5070:. 5055:) 5053:10 5045:(( 5040:cr 5012:] 4995::= 4983::= 4972:) 4960::= 4942::= 4929::= 4917::= 4894:[ 4886::= 4871:: 4845:)) 4758:if 4755:); 4728:of 4707:); 4674:); 4641:); 4608:); 4575:); 4542:); 4470:if 4467:); 4440:of 4419:); 4398:)) 4395:10 4386:of 4332:|| 4245:20 4236:if 4227:in 4218:)) 4206:in 4130:+= 4055:in 4025:if 3974:() 3932:20 3923:if 3920:): 3917:10 3908:in 3887:+= 3787:15 3778:if 3775:do 3772:25 3769:.. 3763:in 3727:F# 3716:F# 3704:XL 3698:XL 3647:() 3558:== 3543:(( 3540:if 3528:in 3451:C# 3445:55 3442:34 3439:21 3436:13 3366:++ 3324:); 3261:++ 3213:). 3186:)) 3135:), 3037:); 3031::: 2971:10 2959:)) 2908:), 2771:+= 2732:do 2632:\n 2611:as 2605:10 2530:++ 2451:\n 2427:as 2424:() 2304:() 2290:. 2265:)) 2232:)) 2229:10 2196:() 2187:() 2131:)) 2122:\n 2110:() 2101:)) 2098:20 2095:10 2070:)) 2061:\n 2049:() 2012:20 1977:xs 1947:xs 1912:$ 1891:$ 1888:)) 1864:(( 1858:$ 1855:)) 1834:/= 1831:(( 1720::: 1714:10 1708:$ 1702:20 1684::: 1639::: 1591:}] 1563:20 1548:10 1516:}} 1479:{{ 1454:. 1434:} 1425:20 1418:if 1377:); 1374:15 1371:.. 1341:}; 1308:my 1290:my 1275:my 1260:my 1204:}; 1183:() 1162:++ 1156:() 1153:++ 1105:!= 1072:() 1036:() 1018:{} 1003:), 906::: 888::: 879:)) 876:10 849:() 824:, 779:); 767:\n 676:}; 658:); 640:-- 622:10 548:. 487:20 478:if 475:do 469:|@ 466::= 430::= 381:. 361:. 345:, 341:, 337:, 335:C# 280:F# 207:. 188:. 5400:. 5380:. 5342:. 5328:. 5316:: 5283:. 5235:. 5187:. 5153:. 5061:. 5059:) 5047:1 5027:. 5018:. 5016:] 5010:r 5004:g 5001:. 4998:z 4992:y 4989:. 4986:y 4980:x 4977:. 4970:y 4967:/ 4964:z 4962:( 4957:r 4954:. 4951:y 4948:+ 4945:x 4939:z 4935:. 4932:1 4926:y 4923:. 4920:0 4914:x 4911:| 4905:| 4902:| 4899:g 4896:: 4857:) 4851:( 4839:, 4833:, 4827:( 4824:c 4821:( 4806:) 4800:( 4788:R 4782:} 4779:; 4773:) 4764:n 4761:( 4752:n 4749:( 4743:. 4737:{ 4734:) 4725:n 4719:( 4695:. 4689:( 4683:. 4662:. 4656:( 4650:. 4629:. 4623:( 4617:. 4596:. 4590:( 4584:. 4563:. 4557:( 4551:. 4530:. 4524:( 4518:. 4506:= 4494:} 4491:; 4485:) 4476:n 4473:( 4464:n 4461:( 4455:. 4449:{ 4437:n 4431:( 4422:} 4416:n 4413:( 4407:. 4401:{ 4392:( 4383:n 4377:( 4368:} 4365:} 4362:; 4359:= 4356:; 4347:{ 4344:) 4326:! 4323:( 4317:; 4314:= 4308:{ 4305:) 4299:( 4293:* 4266:: 4260:) 4257:j 4254:( 4248:: 4239:j 4233:: 4224:j 4215:2 4212:( 4203:n 4197:n 4194:* 4191:n 4188:( 4185:= 4133:2 4127:n 4124:) 4121:n 4118:( 4112:. 4109:p 4106:n 4097:p 4094:, 4091:n 4085:f 4082:* 4079:f 4076:: 4073:f 4067:( 4061:. 4052:f 4046:0 4040:f 4037:% 4034:n 4031:( 4016:: 4007:= 4004:p 4001:3 3998:= 3995:n 3992:2 3983:: 3953:: 3947:) 3944:i 3941:( 3935:: 3926:i 3914:( 3905:i 3890:1 3884:n 3881:n 3875:: 3866:: 3857:) 3851:: 3848:n 3845:( 3805:} 3802:b 3799:* 3796:b 3781:b 3766:0 3760:b 3754:{ 3734:, 3692:} 3689:} 3686:; 3674:; 3662:; 3650:{ 3626:{ 3611:: 3588:} 3585:} 3582:} 3579:; 3567:{ 3564:) 3561:0 3555:) 3552:2 3549:% 3537:{ 3534:) 3519:( 3513:{ 3510:) 3492:( 3433:8 3427:5 3424:3 3421:2 3418:1 3415:1 3405:} 3396:. 3390:( 3384:. 3378:. 3372:{ 3369:) 3363:i 3360:; 3357:5 3351:i 3348:; 3345:0 3342:= 3339:i 3333:( 3318:( 3312:. 3306:. 3300:} 3291:. 3285:( 3279:. 3273:. 3267:{ 3264:) 3258:i 3255:; 3252:5 3246:i 3243:; 3240:0 3237:= 3234:i 3228:( 3210:a 3207:. 3204:p 3198:p 3195:( 3189:. 3183:b 3180:. 3177:p 3174:+ 3171:a 3168:. 3165:p 3162:, 3159:b 3156:. 3153:p 3150:( 3138:p 3132:1 3129:, 3126:1 3123:( 3114:( 3108:. 3099:= 3075:) 3072:b 3066:, 3063:a 3057:( 3025:. 3019:( 3013:. 3007:; 2998:a 2995:. 2992:p 2986:p 2983:( 2977:. 2974:) 2968:( 2962:. 2956:b 2953:. 2950:p 2947:+ 2944:a 2941:. 2938:p 2935:, 2932:b 2929:. 2926:p 2923:( 2911:p 2905:1 2902:, 2899:1 2896:( 2887:( 2881:. 2875:= 2854:) 2851:b 2845:, 2842:a 2836:( 2807:} 2801:. 2792:{ 2786:. 2777:} 2774:1 2768:i 2762:. 2756:{ 2750:0 2747:= 2744:i 2741:| 2735:| 2726:. 2720:= 2711:} 2705:. 2696:{ 2690:. 2687:4 2684:) 2681:( 2675:. 2669:= 2641:} 2638:; 2620:{ 2617:) 2608:) 2602:( 2596:( 2590:} 2587:} 2584:; 2578:- 2575:) 2569:+ 2563:= 2557:( 2554:= 2545:{ 2542:) 2527:( 2521:; 2518:1 2515:= 2509:= 2503:= 2494:{ 2488:: 2485:) 2476:( 2460:} 2457:; 2445:, 2436:{ 2433:) 2418:( 2412:} 2409:} 2406:; 2397:; 2391:- 2385:= 2379:; 2373:+ 2367:= 2361:{ 2358:) 2352:( 2346:; 2343:1 2337:; 2334:1 2331:= 2325:; 2322:0 2319:= 2313:{ 2307:: 2262:g 2259:( 2256:) 2253:g 2250:( 2247:) 2244:g 2241:( 2235:( 2223:( 2220:g 2214:( 2208:i 2202:( 2190:( 2181:( 2178:) 2169:( 2163:( 2160:) 2151:( 2128:i 2113:( 2104:( 2089:( 2080:( 2067:i 2052:( 2043:( 2021:= 2015:) 2006:( 2000:= 1986:= 1980:| 1974:p 1968:: 1965:x 1962:= 1959:x 1956:p 1953:| 1950:) 1944:: 1941:x 1938:( 1935:p 1929:= 1926:p 1885:2 1882:^ 1879:( 1876:. 1873:) 1870:n 1852:n 1846:( 1843:. 1840:) 1837:0 1825:= 1822:n 1816:) 1813:2 1810:+ 1807:n 1804:( 1798:= 1792:| 1789:) 1786:2 1783:+ 1780:n 1777:( 1771:: 1768:n 1765:= 1762:n 1756:| 1753:n 1744:5 1738:: 1735:3 1732:: 1729:2 1726:= 1705:) 1696:( 1690:= 1678:) 1675:1 1672:+ 1669:n 1666:( 1660:: 1657:n 1654:= 1651:n 1609:} 1603:{ 1600:1 1588:} 1579:{ 1576:} 1574:i 1569:{ 1566:} 1554:{ 1551:} 1546:i 1538:{ 1532:[ 1522:} 1512:- 1488:{ 1485:} 1472:{ 1469:} 1463:{ 1407:2 1399:0 1397:( 1368:0 1365:( 1338:} 1335:; 1323:{ 1320:) 1314:( 1302:; 1299:0 1296:= 1287:{ 1281:= 1269:; 1266:= 1254:; 1242:; 1233:; 1201:} 1198:; 1189:{ 1180:* 1171:} 1168:; 1159:{ 1144:} 1141:; 1126:{ 1120:) 1108:( 1093:} 1090:; 1084:* 1078:{ 1057:} 1054:; 1048:* 1042:{ 1015:) 1012:0 1009:( 997:( 991:: 988:) 979:( 973:: 967:; 958:; 949:: 943:{ 927:} 924:; 921:0 915:} 912:; 897:i 882:{ 873:( 867:: 864:i 858:( 852:{ 791:} 788:; 785:0 776:n 773:, 761:( 749:n 746:( 740:; 737:n 731:( 725:; 716:{ 713:) 707:* 701:, 692:( 670:; 655:i 652:( 646:) 643:i 637:; 634:0 628:i 625:; 619:= 616:i 613:( 604:) 598:( 583:; 580:i 574:{ 571:) 565:( 522:C 517:C 502:) 499:j 496:( 481:j 463:j 457:) 454:2 451:^ 448:) 445:0 442:( 436:( 424:j 421:, 272:l 268:g 127:) 121:( 116:) 112:( 102:· 95:· 88:· 81:· 54:. 31:. 20:)

Index

Generator (computer science)
Generator (disambiguation) § Computing

verification
improve this article
adding citations to reliable sources
"Generator" computer programming
news
newspapers
books
scholar
JSTOR
Learn how and when to remove this message
computer science
routine
iteration
loop
iterators
function
array
parameters
memory
iterator
control flow
coroutines
continuations
comparison of coroutines with generators
invoked
object
parameters

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.