Hi Tomsy,
I thought I should send another email, as I may not have answered
the question you are really asking. After reading this again,
I suspect you are perhaps asking about the terminology used to
describe how iterators behave (rather than needing the examples I
sent).
If I am right here, can you suggest some wording that would
clarify the iterators.chpl primer?
Thanks
Tom
On Thu, 19 Nov 2015, Tomsy Paul wrote:
>
>
> Hello all,
>
> I was going through test/release/examples/primers/iterators.chpl
> In the comments of Fibonacci, it is said that
>
> // The first time, this iterator is run, it proceeds this far
> .
> .
> // The next time it is called, execution resumes here
>
> The term call is confusing to me. The iterator takes only one execution, I
> mean entry to the iterator happens only once, isn't it?
>
> Consider the following code
>
> iter fibonacci(n : int)
> {
> var current,next:int;
> if(n==1) then (current,next)=(0,1);
> yield current;
> (current,next)=(next,current+next);
> }
> for i in 1..10 do writeln("Fib(",i,") = ",fibonacci(i));
>
> The output is fib(0) for all values of i. Could you please explain.
>
>
>
------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users