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