The ITERATOR pattern gives a clean interface for element-by-element access to a collection. Imperative iterations using the pattern have two simultaneous aspects: mapping and accumulating . Various existing functional iterations model one or other of these, but not both simultaneously. We argue that McBride and Paterson’s idioms , and in particular the corresponding traverse operator, do exactly this, and therefore capture the essence of the ITERATOR pattern. We present some axioms for traversal, and illustrate with a simple example, the repmin problem.
Content
Author and article information
Contributors
Jeremy Gibbons
Bruno C. d. S. Oliveira
Conference
Publication date:
July
2006
Publication date
(Print):
July
2006
Pages: 1-16
Affiliations
[0001]Oxford University Computing Laboratory
Wolfson Building, Parks Road, Oxford OX1 3QD, UK