The essence of the ITERATOR pattern

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 othe...

Бүрэн тодорхойлолт

Номзүйн дэлгэрэнгүй
Үндсэн зохиолчид: Gibbons, J, Oliveira, B
Формат: Conference item
Хэвлэсэн: 2009
_version_ 1826293876085751808
author Gibbons, J
Oliveira, B
author_facet Gibbons, J
Oliveira, B
author_sort Gibbons, J
collection OXFORD
description 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.
first_indexed 2024-03-07T03:36:55Z
format Conference item
id oxford-uuid:bc9c36b2-e0ee-4dd2-b1fe-989aab7c3d1d
institution University of Oxford
last_indexed 2024-03-07T03:36:55Z
publishDate 2009
record_format dspace
spelling oxford-uuid:bc9c36b2-e0ee-4dd2-b1fe-989aab7c3d1d2022-03-27T05:25:34ZThe essence of the ITERATOR patternConference itemhttp://purl.org/coar/resource_type/c_5794uuid:bc9c36b2-e0ee-4dd2-b1fe-989aab7c3d1dSymplectic Elements at Oxford2009Gibbons, JOliveira, BThe 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.
spellingShingle Gibbons, J
Oliveira, B
The essence of the ITERATOR pattern
title The essence of the ITERATOR pattern
title_full The essence of the ITERATOR pattern
title_fullStr The essence of the ITERATOR pattern
title_full_unstemmed The essence of the ITERATOR pattern
title_short The essence of the ITERATOR pattern
title_sort essence of the iterator pattern
work_keys_str_mv AT gibbonsj theessenceoftheiteratorpattern
AT oliveirab theessenceoftheiteratorpattern
AT gibbonsj essenceoftheiteratorpattern
AT oliveirab essenceoftheiteratorpattern