Conference item icon

Conference item

The essence of the ITERATOR pattern

Abstract:
The Iterator pattern gives a clean interface for element-by-element access to a collection, independent of the collection's shape. Imperative iterations using the pattern have two simultaneous aspects: mapping and accumulating. Various existing functional models of iteration capture one or other of these aspects, but not both simultaneously. We argue that C. McBride and R. Paterson's applicative functors (Applicative programming with effects, J. Funct. Program., 18 (1): 113, 2008), and in particular the corresponding traverse operator, do exactly this, and therefore capture the essence of the Iterator pattern. Moreover, they do so in a way that nicely supports modular programming. We present some axioms for traversal, discuss modularity concerns and illustrate with a simple example, the wordcount problem. © 2009 Copyright Cambridge University Press.
Publication status:
Published

Actions

Access Document

Publisher copy:
10.1017/S0956796809007291

Authors

More by this author
Institution:
University of Oxford
Division:
MPLS
Department:
Computer Science
Role:
Author


Host title:
JOURNAL OF FUNCTIONAL PROGRAMMING
Volume:
19
Issue:
3-4
Pages:
377-402
Publication date:
2009-01-01
DOI:
EISSN:
1469-7653
ISSN:
0956-7968


Pubs id:
pubs:163466
UUID:
uuid:bc9c36b2-e0ee-4dd2-b1fe-989aab7c3d1d
Local pid:
pubs:163466
Source identifiers:
163466
Deposit date:
2012-12-19
ARK identifier:

Terms of use


Views and Downloads






If you are the owner of this record, you can report an update to it here: Report update to this record

TO TOP