Hostname: page-component-8448b6f56d-mp689 Total loading time: 0 Render date: 2024-04-17T09:57:42.130Z Has data issue: false hasContentIssue false

Weaving a web

Published online by Cambridge University Press:  28 November 2001

RALF HINZE
Affiliation:
Institut für Informatik III, Universität Bonn, Römerstraße 164, 53117 Bonn, Germany; (e-mail: ralf@informatik.uni-bonn.de)
JOHAN JEURING
Affiliation:
Institute of Information and Computing Sciences, Utrecht University, P.O.Box 80.089, 3508 TB Utrecht, The Netherlands; (e-mail: johanj@cs.uu.nl)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

Suppose, you want to implement a structured editor for some term type, so that the user can navigate through a given term and perform edit actions on subterms. In this case you are immediately faced with the problem of how to keep track of the cursor movements and the user's edits in a reasonably efficient manner. In a previous pearl, Huet (1997) introduced a simple data structure, the Zipper, that addresses this problem – we will explain the Zipper briefly in section 2. A drawback of the Zipper is that the type of cursor locations depends on the structure of the term type, i.e. each term type gives rise to a different type of location (unless you are working in an untyped environment). In this pearl, we present an alternative data structure, the web, that serves the same purpose, but that is parametric in the underlying term type. Sections 3–6 are devoted to the new data structure. Before we unravel the Zipper and explore the web, let us first give a taste of their use.

Type
Functional Pearls
Copyright
© 2001 Cambridge University Press
Submit a response

Discussions

No Discussions have been published for this article.