Hostname: page-component-8448b6f56d-c47g7 Total loading time: 0 Render date: 2024-04-18T23:25:32.032Z Has data issue: false hasContentIssue false

A tutorial on the universality and expressiveness of fold

Published online by Cambridge University Press:  01 July 1999

GRAHAM HUTTON
Affiliation:
University of Nottingham, Nottingham, UK; http://www.cs.nott.ac.uk/-gmh
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.

In functional programming, fold is a standard operator that encapsulates a simple pattern of recursion for processing lists. This article is a tutorial on two key aspects of the fold operator for lists. First of all, we emphasize the use of the universal property of fold both as a proof principle that avoids the need for inductive proofs, and as a definition principle that guides the transformation of recursive functions into definitions using fold. Secondly, we show that even though the pattern of recursion encapsulated by fold is simple, in a language with tuples and functions as first-class values the fold operator has greater expressive power than might first be expected.

Type
Research Article
Copyright
© 1999 Cambridge University Press
Submit a response

Discussions

No Discussions have been published for this article.