Iterators provide access to elements of an abstract structured object in some sequence.It is argued that parallel composition of iterators should be achieved implicitly by means of a generalized for loop rather than by use of mutually interacting coroutines.The generalized for loop employs controlled iteration, which is shown to be a powerful yet inexpensive construct.The generalized for loop is consistent with block structure, and, for program proof purposes, is much more tractable than an unrestricted loop.Concrete programming examples are used extensively.
i. Data structures and iterationWhen a programming language permits the specification of abstract data types, there arises the question of how much properly belongs to the specification.Our intent is to contribute to the answer to this question.For the purposes of this discussion it will be assumed that a data type is visible to a programmer merely as the values delivered by a set of access functions.