Iterators

  • Baker H
N/ACitations
Citations of this article
10Readers
Mendeley users who have this article in their library.

Abstract

The appearance of iterators in an object-oriented language appears to be inversely related to the power of the language's intrinsic control structures. Iterator classes are used for the sole purpose of enumerating the elements of an abstract collection class without revealing its implementation. We find that the availability of higher-order functions and function closures eliminates the need for these ad hoc iterator classes, in addition to providing the other benefits of "mostly functional programming". We examine a purely functional iteration protocol for the difficult task of comparing the collections of leaves on two non-isomorphic trees---the so-called "samefringe" problem---and find that its type signature requires recursive (cyclic) functional types. Although higher-order "member functions" and recursive (cyclic) functional types are unusual in object-oriented languages, they arise quite naturally and provide a satisfying programming style.

Cite

CITATION STYLE

APA

Baker, H. G. (1993). Iterators. ACM SIGPLAN OOPS Messenger, 4(3), 18–25. https://doi.org/10.1145/165507.165514

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free