On Fri, Nov 20, 2015 at 1:30 AM, Tom MacDonald <[email protected]> wrote:

> 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).
>
>
You are right!!


> If I am right here, can you suggest some wording that would
> clarify the iterators.chpl primer?
>
>
I don't know whether these are the apt wordings. You please go through
these suggestions.

*One* (Line 18)
// Each time the iterator runs, it returns the current Fibonacci number,
// and then updates the state to the next one.

may be replaced with

// Each time the yield statement is reached, it outputs the current
Fibonacci number,
// and then updates the state to the next one.

*Two* (Line 24)
// The first time this iterator is run, it proceeds this far
// and then yields (returns) the first value of current (== 0),
// and its state is preserved.
// The next time it is called, execution resumes here.
// It continues until another yield is reached.
// If the iterator completes or encounters a return statement,
// execution of the enclosing loop terminates immediately.

may be replaced with

// When this iterator runs, it proceeds this far
// and yields (outputs) the first value of current (== 0),
// and its state is changed in the next statement.
// In the next iteration, it yields the new value of current (== 1) and so
on
// If the iterator completes or encounters a return statement,
// execution of the enclosing loop terminates immediately.

The term 'returns' would mean 'returning control from the iterator' rather
than 'returning data'. I think this is the case of Coroutines. We need to
show returning only the data. That's why I have used 'outputs' instead of
'returns'.

Your comments please.
------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to