Skip to main navigation Skip to search Skip to main content

Backtracking iterators

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

Abstract

Iterating over the elements of an abstract collection is usually done in ML using a fold-like higher-order function provided by the data structure. This article discusses a different paradigm of iteration based on purely functional, immutable cursors. Contrary to fold-like iterators, the iteration can be cleanly interrupted at any step. Contrary to imperative cursors (such as those found in C++ and Java libraries) it is possible to backtrack the iterator to a previous step. Several ways to iterate over binary trees are examined and close links with Gérard Huet's Zipper are established. Incidentally, we show the well-known two-lists implementation of functional queues arising from a Zipper-based breadth-first traversal.

Original languageEnglish
Title of host publicationProceedings of the ACM SIGPLAN 2006 Workshop on ML
PublisherAssociation for Computing Machinery (ACM)
Pages54-62
Number of pages9
ISBN (Print)1595934839, 9781595934833
DOIs
Publication statusPublished - 16 Sept 2006
EventACM SIGPLAN 2006 Workshop on ML - Portland, OR, United States
Duration: 16 Sept 200616 Sept 2006

Publication series

NameProceedings of the ACM SIGPLAN 2006 Workshop on ML
Volume2006

Conference

ConferenceACM SIGPLAN 2006 Workshop on ML
Country/TerritoryUnited States
CityPortland, OR
Period16/09/0616/09/06

Keywords

  • Backtracking
  • Iteration
  • Persistent data structures

Fingerprint

Dive into the research topics of 'Backtracking iterators'. Together they form a unique fingerprint.

Cite this