|
@@
-296,6
+296,8
b' hgweb fileannotate, html'
|
|
296
|
<div class="annotate-info">
|
|
296
|
<div class="annotate-info">
|
|
297
|
<div>06824edf55d0: a</div>
|
|
297
|
<div>06824edf55d0: a</div>
|
|
298
|
<div>parents: </div>
|
|
298
|
<div>parents: </div>
|
|
|
|
|
299
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
300
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
299
|
</div>
|
|
301
|
</div>
|
|
300
|
</td>
|
|
302
|
</td>
|
|
301
|
<td class="source"><a href="#l1"> 1</a> <span class="c">#!/usr/bin/env python</span></td>
|
|
303
|
<td class="source"><a href="#l1"> 1</a> <span class="c">#!/usr/bin/env python</span></td>
|
|
@@
-306,6
+308,8
b' hgweb fileannotate, html'
|
|
306
|
<div class="annotate-info">
|
|
308
|
<div class="annotate-info">
|
|
307
|
<div>06824edf55d0: a</div>
|
|
309
|
<div>06824edf55d0: a</div>
|
|
308
|
<div>parents: </div>
|
|
310
|
<div>parents: </div>
|
|
|
|
|
311
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
312
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
309
|
</div>
|
|
313
|
</div>
|
|
310
|
</td>
|
|
314
|
</td>
|
|
311
|
<td class="source"><a href="#l2"> 2</a> </td>
|
|
315
|
<td class="source"><a href="#l2"> 2</a> </td>
|
|
@@
-316,6
+320,8
b' hgweb fileannotate, html'
|
|
316
|
<div class="annotate-info">
|
|
320
|
<div class="annotate-info">
|
|
317
|
<div>06824edf55d0: a</div>
|
|
321
|
<div>06824edf55d0: a</div>
|
|
318
|
<div>parents: </div>
|
|
322
|
<div>parents: </div>
|
|
|
|
|
323
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
324
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
319
|
</div>
|
|
325
|
</div>
|
|
320
|
</td>
|
|
326
|
</td>
|
|
321
|
<td class="source"><a href="#l3"> 3</a> <span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></td>
|
|
327
|
<td class="source"><a href="#l3"> 3</a> <span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></td>
|
|
@@
-326,6
+332,8
b' hgweb fileannotate, html'
|
|
326
|
<div class="annotate-info">
|
|
332
|
<div class="annotate-info">
|
|
327
|
<div>06824edf55d0: a</div>
|
|
333
|
<div>06824edf55d0: a</div>
|
|
328
|
<div>parents: </div>
|
|
334
|
<div>parents: </div>
|
|
|
|
|
335
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
336
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
329
|
</div>
|
|
337
|
</div>
|
|
330
|
</td>
|
|
338
|
</td>
|
|
331
|
<td class="source"><a href="#l4"> 4</a> </td>
|
|
339
|
<td class="source"><a href="#l4"> 4</a> </td>
|
|
@@
-336,6
+344,8
b' hgweb fileannotate, html'
|
|
336
|
<div class="annotate-info">
|
|
344
|
<div class="annotate-info">
|
|
337
|
<div>06824edf55d0: a</div>
|
|
345
|
<div>06824edf55d0: a</div>
|
|
338
|
<div>parents: </div>
|
|
346
|
<div>parents: </div>
|
|
|
|
|
347
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
348
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
339
|
</div>
|
|
349
|
</div>
|
|
340
|
</td>
|
|
350
|
</td>
|
|
341
|
<td class="source"><a href="#l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
|
|
351
|
<td class="source"><a href="#l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
|
|
@@
-346,6
+356,8
b' hgweb fileannotate, html'
|
|
346
|
<div class="annotate-info">
|
|
356
|
<div class="annotate-info">
|
|
347
|
<div>06824edf55d0: a</div>
|
|
357
|
<div>06824edf55d0: a</div>
|
|
348
|
<div>parents: </div>
|
|
358
|
<div>parents: </div>
|
|
|
|
|
359
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
360
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
349
|
</div>
|
|
361
|
</div>
|
|
350
|
</td>
|
|
362
|
</td>
|
|
351
|
<td class="source"><a href="#l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></td>
|
|
363
|
<td class="source"><a href="#l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></td>
|
|
@@
-356,6
+368,8
b' hgweb fileannotate, html'
|
|
356
|
<div class="annotate-info">
|
|
368
|
<div class="annotate-info">
|
|
357
|
<div>06824edf55d0: a</div>
|
|
369
|
<div>06824edf55d0: a</div>
|
|
358
|
<div>parents: </div>
|
|
370
|
<div>parents: </div>
|
|
|
|
|
371
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
372
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
359
|
</div>
|
|
373
|
</div>
|
|
360
|
</td>
|
|
374
|
</td>
|
|
361
|
<td class="source"><a href="#l7"> 7</a> <span class="sd">"""</span></td>
|
|
375
|
<td class="source"><a href="#l7"> 7</a> <span class="sd">"""</span></td>
|
|
@@
-366,6
+380,8
b' hgweb fileannotate, html'
|
|
366
|
<div class="annotate-info">
|
|
380
|
<div class="annotate-info">
|
|
367
|
<div>06824edf55d0: a</div>
|
|
381
|
<div>06824edf55d0: a</div>
|
|
368
|
<div>parents: </div>
|
|
382
|
<div>parents: </div>
|
|
|
|
|
383
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
384
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
369
|
</div>
|
|
385
|
</div>
|
|
370
|
</td>
|
|
386
|
</td>
|
|
371
|
<td class="source"><a href="#l8"> 8</a> </td>
|
|
387
|
<td class="source"><a href="#l8"> 8</a> </td>
|
|
@@
-376,6
+392,8
b' hgweb fileannotate, html'
|
|
376
|
<div class="annotate-info">
|
|
392
|
<div class="annotate-info">
|
|
377
|
<div>06824edf55d0: a</div>
|
|
393
|
<div>06824edf55d0: a</div>
|
|
378
|
<div>parents: </div>
|
|
394
|
<div>parents: </div>
|
|
|
|
|
395
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
396
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
379
|
</div>
|
|
397
|
</div>
|
|
380
|
</td>
|
|
398
|
</td>
|
|
381
|
<td class="source"><a href="#l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
|
|
399
|
<td class="source"><a href="#l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
|
|
@@
-386,6
+404,8
b' hgweb fileannotate, html'
|
|
386
|
<div class="annotate-info">
|
|
404
|
<div class="annotate-info">
|
|
387
|
<div>06824edf55d0: a</div>
|
|
405
|
<div>06824edf55d0: a</div>
|
|
388
|
<div>parents: </div>
|
|
406
|
<div>parents: </div>
|
|
|
|
|
407
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
408
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
389
|
</div>
|
|
409
|
</div>
|
|
390
|
</td>
|
|
410
|
</td>
|
|
391
|
<td class="source"><a href="#l10"> 10</a> </td>
|
|
411
|
<td class="source"><a href="#l10"> 10</a> </td>
|
|
@@
-396,6
+416,8
b' hgweb fileannotate, html'
|
|
396
|
<div class="annotate-info">
|
|
416
|
<div class="annotate-info">
|
|
397
|
<div>06824edf55d0: a</div>
|
|
417
|
<div>06824edf55d0: a</div>
|
|
398
|
<div>parents: </div>
|
|
418
|
<div>parents: </div>
|
|
|
|
|
419
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
420
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
399
|
</div>
|
|
421
|
</div>
|
|
400
|
</td>
|
|
422
|
</td>
|
|
401
|
<td class="source"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
|
|
423
|
<td class="source"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
|
|
@@
-406,6
+428,8
b' hgweb fileannotate, html'
|
|
406
|
<div class="annotate-info">
|
|
428
|
<div class="annotate-info">
|
|
407
|
<div>06824edf55d0: a</div>
|
|
429
|
<div>06824edf55d0: a</div>
|
|
408
|
<div>parents: </div>
|
|
430
|
<div>parents: </div>
|
|
|
|
|
431
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
432
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
409
|
</div>
|
|
433
|
</div>
|
|
410
|
</td>
|
|
434
|
</td>
|
|
411
|
<td class="source"><a href="#l12"> 12</a> <span class="sd">"""Generate all primes."""</span></td>
|
|
435
|
<td class="source"><a href="#l12"> 12</a> <span class="sd">"""Generate all primes."""</span></td>
|
|
@@
-416,6
+440,8
b' hgweb fileannotate, html'
|
|
416
|
<div class="annotate-info">
|
|
440
|
<div class="annotate-info">
|
|
417
|
<div>06824edf55d0: a</div>
|
|
441
|
<div>06824edf55d0: a</div>
|
|
418
|
<div>parents: </div>
|
|
442
|
<div>parents: </div>
|
|
|
|
|
443
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
444
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
419
|
</div>
|
|
445
|
</div>
|
|
420
|
</td>
|
|
446
|
</td>
|
|
421
|
<td class="source"><a href="#l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
|
|
447
|
<td class="source"><a href="#l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
|
|
@@
-426,6
+452,8
b' hgweb fileannotate, html'
|
|
426
|
<div class="annotate-info">
|
|
452
|
<div class="annotate-info">
|
|
427
|
<div>06824edf55d0: a</div>
|
|
453
|
<div>06824edf55d0: a</div>
|
|
428
|
<div>parents: </div>
|
|
454
|
<div>parents: </div>
|
|
|
|
|
455
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
456
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
429
|
</div>
|
|
457
|
</div>
|
|
430
|
</td>
|
|
458
|
</td>
|
|
431
|
<td class="source"><a href="#l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
|
|
459
|
<td class="source"><a href="#l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
|
|
@@
-436,6
+464,8
b' hgweb fileannotate, html'
|
|
436
|
<div class="annotate-info">
|
|
464
|
<div class="annotate-info">
|
|
437
|
<div>06824edf55d0: a</div>
|
|
465
|
<div>06824edf55d0: a</div>
|
|
438
|
<div>parents: </div>
|
|
466
|
<div>parents: </div>
|
|
|
|
|
467
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
468
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
439
|
</div>
|
|
469
|
</div>
|
|
440
|
</td>
|
|
470
|
</td>
|
|
441
|
<td class="source"><a href="#l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td>
|
|
471
|
<td class="source"><a href="#l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td>
|
|
@@
-446,6
+476,8
b' hgweb fileannotate, html'
|
|
446
|
<div class="annotate-info">
|
|
476
|
<div class="annotate-info">
|
|
447
|
<div>06824edf55d0: a</div>
|
|
477
|
<div>06824edf55d0: a</div>
|
|
448
|
<div>parents: </div>
|
|
478
|
<div>parents: </div>
|
|
|
|
|
479
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
480
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
449
|
</div>
|
|
481
|
</div>
|
|
450
|
</td>
|
|
482
|
</td>
|
|
451
|
<td class="source"><a href="#l16"> 16</a> <span class="c"># infinite recursion.</span></td>
|
|
483
|
<td class="source"><a href="#l16"> 16</a> <span class="c"># infinite recursion.</span></td>
|
|
@@
-456,6
+488,8
b' hgweb fileannotate, html'
|
|
456
|
<div class="annotate-info">
|
|
488
|
<div class="annotate-info">
|
|
457
|
<div>06824edf55d0: a</div>
|
|
489
|
<div>06824edf55d0: a</div>
|
|
458
|
<div>parents: </div>
|
|
490
|
<div>parents: </div>
|
|
|
|
|
491
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
492
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
459
|
</div>
|
|
493
|
</div>
|
|
460
|
</td>
|
|
494
|
</td>
|
|
461
|
<td class="source"><a href="#l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td>
|
|
495
|
<td class="source"><a href="#l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td>
|
|
@@
-466,6
+500,8
b' hgweb fileannotate, html'
|
|
466
|
<div class="annotate-info">
|
|
500
|
<div class="annotate-info">
|
|
467
|
<div>06824edf55d0: a</div>
|
|
501
|
<div>06824edf55d0: a</div>
|
|
468
|
<div>parents: </div>
|
|
502
|
<div>parents: </div>
|
|
|
|
|
503
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
504
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
469
|
</div>
|
|
505
|
</div>
|
|
470
|
</td>
|
|
506
|
</td>
|
|
471
|
<td class="source"><a href="#l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
|
|
507
|
<td class="source"><a href="#l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
|
|
@@
-476,6
+512,8
b' hgweb fileannotate, html'
|
|
476
|
<div class="annotate-info">
|
|
512
|
<div class="annotate-info">
|
|
477
|
<div>06824edf55d0: a</div>
|
|
513
|
<div>06824edf55d0: a</div>
|
|
478
|
<div>parents: </div>
|
|
514
|
<div>parents: </div>
|
|
|
|
|
515
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
516
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
479
|
</div>
|
|
517
|
</div>
|
|
480
|
</td>
|
|
518
|
</td>
|
|
481
|
<td class="source"><a href="#l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
|
|
519
|
<td class="source"><a href="#l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
|
|
@@
-486,6
+524,8
b' hgweb fileannotate, html'
|
|
486
|
<div class="annotate-info">
|
|
524
|
<div class="annotate-info">
|
|
487
|
<div>06824edf55d0: a</div>
|
|
525
|
<div>06824edf55d0: a</div>
|
|
488
|
<div>parents: </div>
|
|
526
|
<div>parents: </div>
|
|
|
|
|
527
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
528
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
489
|
</div>
|
|
529
|
</div>
|
|
490
|
</td>
|
|
530
|
</td>
|
|
491
|
<td class="source"><a href="#l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td>
|
|
531
|
<td class="source"><a href="#l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td>
|
|
@@
-496,6
+536,8
b' hgweb fileannotate, html'
|
|
496
|
<div class="annotate-info">
|
|
536
|
<div class="annotate-info">
|
|
497
|
<div>06824edf55d0: a</div>
|
|
537
|
<div>06824edf55d0: a</div>
|
|
498
|
<div>parents: </div>
|
|
538
|
<div>parents: </div>
|
|
|
|
|
539
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
540
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
499
|
</div>
|
|
541
|
</div>
|
|
500
|
</td>
|
|
542
|
</td>
|
|
501
|
<td class="source"><a href="#l21"> 21</a> </td>
|
|
543
|
<td class="source"><a href="#l21"> 21</a> </td>
|
|
@@
-506,6
+548,8
b' hgweb fileannotate, html'
|
|
506
|
<div class="annotate-info">
|
|
548
|
<div class="annotate-info">
|
|
507
|
<div>06824edf55d0: a</div>
|
|
549
|
<div>06824edf55d0: a</div>
|
|
508
|
<div>parents: </div>
|
|
550
|
<div>parents: </div>
|
|
|
|
|
551
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
552
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
509
|
</div>
|
|
553
|
</div>
|
|
510
|
</td>
|
|
554
|
</td>
|
|
511
|
<td class="source"><a href="#l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
|
|
555
|
<td class="source"><a href="#l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
|
|
@@
-516,6
+560,8
b' hgweb fileannotate, html'
|
|
516
|
<div class="annotate-info">
|
|
560
|
<div class="annotate-info">
|
|
517
|
<div>06824edf55d0: a</div>
|
|
561
|
<div>06824edf55d0: a</div>
|
|
518
|
<div>parents: </div>
|
|
562
|
<div>parents: </div>
|
|
|
|
|
563
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
564
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
519
|
</div>
|
|
565
|
</div>
|
|
520
|
</td>
|
|
566
|
</td>
|
|
521
|
<td class="source"><a href="#l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o"><</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td>
|
|
567
|
<td class="source"><a href="#l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o"><</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td>
|
|
@@
-526,6
+572,8
b' hgweb fileannotate, html'
|
|
526
|
<div class="annotate-info">
|
|
572
|
<div class="annotate-info">
|
|
527
|
<div>06824edf55d0: a</div>
|
|
573
|
<div>06824edf55d0: a</div>
|
|
528
|
<div>parents: </div>
|
|
574
|
<div>parents: </div>
|
|
|
|
|
575
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
576
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
529
|
</div>
|
|
577
|
</div>
|
|
530
|
</td>
|
|
578
|
</td>
|
|
531
|
<td class="source"><a href="#l24"> 24</a> </td>
|
|
579
|
<td class="source"><a href="#l24"> 24</a> </td>
|
|
@@
-536,6
+584,8
b' hgweb fileannotate, html'
|
|
536
|
<div class="annotate-info">
|
|
584
|
<div class="annotate-info">
|
|
537
|
<div>06824edf55d0: a</div>
|
|
585
|
<div>06824edf55d0: a</div>
|
|
538
|
<div>parents: </div>
|
|
586
|
<div>parents: </div>
|
|
|
|
|
587
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
588
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
539
|
</div>
|
|
589
|
</div>
|
|
540
|
</td>
|
|
590
|
</td>
|
|
541
|
<td class="source"><a href="#l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></td>
|
|
591
|
<td class="source"><a href="#l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></td>
|
|
@@
-546,6
+596,8
b' hgweb fileannotate, html'
|
|
546
|
<div class="annotate-info">
|
|
596
|
<div class="annotate-info">
|
|
547
|
<div>06824edf55d0: a</div>
|
|
597
|
<div>06824edf55d0: a</div>
|
|
548
|
<div>parents: </div>
|
|
598
|
<div>parents: </div>
|
|
|
|
|
599
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
600
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
549
|
</div>
|
|
601
|
</div>
|
|
550
|
</td>
|
|
602
|
</td>
|
|
551
|
<td class="source"><a href="#l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td>
|
|
603
|
<td class="source"><a href="#l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td>
|
|
@@
-556,6
+608,8
b' hgweb fileannotate, html'
|
|
556
|
<div class="annotate-info">
|
|
608
|
<div class="annotate-info">
|
|
557
|
<div>06824edf55d0: a</div>
|
|
609
|
<div>06824edf55d0: a</div>
|
|
558
|
<div>parents: </div>
|
|
610
|
<div>parents: </div>
|
|
|
|
|
611
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
612
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
559
|
</div>
|
|
613
|
</div>
|
|
560
|
</td>
|
|
614
|
</td>
|
|
561
|
<td class="source"><a href="#l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td>
|
|
615
|
<td class="source"><a href="#l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td>
|
|
@@
-566,6
+620,8
b' hgweb fileannotate, html'
|
|
566
|
<div class="annotate-info">
|
|
620
|
<div class="annotate-info">
|
|
567
|
<div>06824edf55d0: a</div>
|
|
621
|
<div>06824edf55d0: a</div>
|
|
568
|
<div>parents: </div>
|
|
622
|
<div>parents: </div>
|
|
|
|
|
623
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
624
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
569
|
</div>
|
|
625
|
</div>
|
|
570
|
</td>
|
|
626
|
</td>
|
|
571
|
<td class="source"><a href="#l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></td>
|
|
627
|
<td class="source"><a href="#l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></td>
|
|
@@
-576,6
+632,8
b' hgweb fileannotate, html'
|
|
576
|
<div class="annotate-info">
|
|
632
|
<div class="annotate-info">
|
|
577
|
<div>06824edf55d0: a</div>
|
|
633
|
<div>06824edf55d0: a</div>
|
|
578
|
<div>parents: </div>
|
|
634
|
<div>parents: </div>
|
|
|
|
|
635
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
636
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
579
|
</div>
|
|
637
|
</div>
|
|
580
|
</td>
|
|
638
|
</td>
|
|
581
|
<td class="source"><a href="#l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
|
|
639
|
<td class="source"><a href="#l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
|
|
@@
-586,6
+644,8
b' hgweb fileannotate, html'
|
|
586
|
<div class="annotate-info">
|
|
644
|
<div class="annotate-info">
|
|
587
|
<div>06824edf55d0: a</div>
|
|
645
|
<div>06824edf55d0: a</div>
|
|
588
|
<div>parents: </div>
|
|
646
|
<div>parents: </div>
|
|
|
|
|
647
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
648
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
589
|
</div>
|
|
649
|
</div>
|
|
590
|
</td>
|
|
650
|
</td>
|
|
591
|
<td class="source"><a href="#l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></td>
|
|
651
|
<td class="source"><a href="#l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></td>
|
|
@@
-596,6
+656,8
b' hgweb fileannotate, html'
|
|
596
|
<div class="annotate-info">
|
|
656
|
<div class="annotate-info">
|
|
597
|
<div>06824edf55d0: a</div>
|
|
657
|
<div>06824edf55d0: a</div>
|
|
598
|
<div>parents: </div>
|
|
658
|
<div>parents: </div>
|
|
|
|
|
659
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
660
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
599
|
</div>
|
|
661
|
</div>
|
|
600
|
</td>
|
|
662
|
</td>
|
|
601
|
<td class="source"><a href="#l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
|
|
663
|
<td class="source"><a href="#l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
|
|
@@
-606,6
+668,8
b' hgweb fileannotate, html'
|
|
606
|
<div class="annotate-info">
|
|
668
|
<div class="annotate-info">
|
|
607
|
<div>06824edf55d0: a</div>
|
|
669
|
<div>06824edf55d0: a</div>
|
|
608
|
<div>parents: </div>
|
|
670
|
<div>parents: </div>
|
|
|
|
|
671
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
672
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
609
|
</div>
|
|
673
|
</div>
|
|
610
|
</td>
|
|
674
|
</td>
|
|
611
|
<td class="source"><a href="#l32"> 32</a> <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
|
|
675
|
<td class="source"><a href="#l32"> 32</a> <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
|
|
@@
-616,6
+680,8
b' hgweb fileannotate, html'
|
|
616
|
<div class="annotate-info">
|
|
680
|
<div class="annotate-info">
|
|
617
|
<div>06824edf55d0: a</div>
|
|
681
|
<div>06824edf55d0: a</div>
|
|
618
|
<div>parents: </div>
|
|
682
|
<div>parents: </div>
|
|
|
|
|
683
|
<a href="/diff/06824edf55d0/primes.py">diff</a>
|
|
|
|
|
684
|
<a href="/rev/06824edf55d0">changeset</a>
|
|
619
|
</div>
|
|
685
|
</div>
|
|
620
|
</td>
|
|
686
|
</td>
|
|
621
|
<td class="source"><a href="#l33"> 33</a> </td>
|
|
687
|
<td class="source"><a href="#l33"> 33</a> </td>
|