Thank you for the working example! Now it works as it should.

* * *

Your second example always return 1 in a loop, because it yields a.

Your output is:
    
    
    1
    1
    1
    1
    1
    10
    100
    

and one could think new iterators have been invoked (with the starting values 
of a = 10 and 100, respectively).

Changing to yield c gives: 
    
    
    1
    1
    1
    1
    1
    20
    999
    

Now it is clear that (in both cases) iterator just continues where it has 
stopped, there was no new iterators!

But the syntax (to me) really feels/looks like a new iterator (with new 
starting values) was called. I can't shake the feeling about wrong-looking 
syntax.

* * *

Your first example with proc slightly remedies this.

There is system.finished which can be used with iterators. I still think some 
kind of system.next would be of great help with readability/usability of 
iterators.

Reply via email to