## A tutorial on the universality and expressiveness of fold (1999)

### Cached

### Download Links

Citations: | 59 - 11 self |

### BibTeX

@MISC{Hutton99atutorial,

author = {Graham Hutton},

title = {A tutorial on the universality and expressiveness of fold},

year = {1999}

}

### OpenURL

### Abstract

### Citations

1332 | Monads for functional programming
- Wadler
- 1993
(Show Context)
Citation Context ... has its origins in recursion theory. The first systematic use of the universal property in functional programming was by Malcolm (1990a), in his generalisation of Bird and Meerten's theory of lists (=-=Bird, 1989-=-; Meertens, 1983) to arbitrary regular datatypes. For finite lists, the universal property of fold can be stated as the following equivalence between two definitions for a function g that processes li... |

1134 | The Lambda calculus: Its syntax and semantics - Barendregt - 1984 |

719 |
Introduction to Metamathematics. D
- Kleene
- 1952
(Show Context)
Citation Context ...nguage. However, no special features of Haskell are used, and the ideas can easily be adapted to other functional languages. 2 The fold operator The fold operator has its origins in recursion theory (=-=Kleene, 1952-=-), while the use of fold as a central concept in a programming language dates back to the reduction operator of APL (Iverson, 1962), and later to the insertion operator of FP (Backus, 1978). In Haskel... |

465 | Comprehending Monads
- Wadler
- 1990
(Show Context)
Citation Context ...es, Wadler showed how pure functional programs that require imperative features such as state and exceptions can be A tutorial on the universality and expressiveness of fold 15 modelled using monads (=-=Wadler, 1990-=-; Wadler, 1992a; Wadler, 1992b). Building on this work, the notion of a `monadic fold' combines the use of fold operators to structure the processing of recursive values with the use of monads to stru... |

459 |
Can programming be liberated from the von Neumann style? A functional style and its algebra of programs
- Backus
- 1978
(Show Context)
Citation Context ...ion theory (Kleene, 1952), while the use of fold as a central concept in a programming language dates back to the reduction operator of APL (Iverson, 1962), and later to the insertion operator of FP (=-=Backus, 1978-=-). In Haskell, the fold operator for lists can be defined as follows: fold :: (ff ! fi ! fi) ! fi ! ([ff] ! fi) fold f v [ ] = v fold f v (x : xs) = f x (fold f v xs) That is, given a function f of ty... |

303 | Functional programming with bananas, lenses, envelopes and barbed wire - Meijer, Fokkinga, et al. - 1991 |

223 |
A Programming Language
- Iverson
- 1962
(Show Context)
Citation Context ...e fold operator The fold operator has its origins in recursion theory (Kleene, 1952), while the use of fold as a central concept in a programming language dates back to the reduction operator of APL (=-=Iverson, 1962-=-), and later to the insertion operator of FP (Backus, 1978). In Haskell, the fold operator for lists can be defined as follows: fold :: (α → β → β) → β → ([α] → β) fold f v [] = v fold f v (x : xs) = ... |

220 |
Introduction to Functional Programming Using Haskell
- Bird
- 1998
(Show Context)
Citation Context ... on recursion operators that we do not have space to pursue here. The article is aimed at a reader who is familiar with the basics of functional programming, say to the level of (Bird & Wadler, 1988; =-=Bird, 1998-=-). All programs in the article are written in Haskell (Peterson et al. , 1997), the standard lazy functional programming language. However, no special features of Haskell are used, and the ideas can e... |

175 | PolyP—a polytypic programming language extension - Jansson, Jeuring - 1997 |

159 |
The lambda calculus, its syntax and semantics. North-Holland, revised edition
- Barendregt
- 1984
(Show Context)
Citation Context ...e redefined in terms of fold . Note that the use of tupling to define primitive recursive functions in terms of fold is precisely the key to defining the predecessor function for the Church numerals (=-=Barendregt, 1984-=-). Indeed, the intuition behind the representation of the natural numbers (or more generally, any inductive datatype) in the -calculus is the idea of representing each number by its fold operator. For... |

111 | A fold for all seasons - Sheard, Fegaras - 1993 |

96 | Bananas in space: extending fold and unfold to exponential types
- Meijer, Hutton
- 1995
(Show Context)
Citation Context ... structures in programs (deforestation) in considerably simplified when programs are written using recursion operators rather than general recursion (Wadler, 1981; Launchbury & Sheard, 1995; Takano & =-=Meijer, 1995-=-). A generic system for transforming programs written using recursion operators is currently under development (de Moor & Sittampalan, 1998). Polytypic programming. Defining programs that are not spec... |

95 |
Algorithmics –towards programming as a mathematical activity
- Meertens
- 1986
(Show Context)
Citation Context ...gins in recursion theory. The first systematic use of the universal property in functional programming was by Malcolm (1990a), in his generalisation of Bird and Meerten's theory of lists (Bird, 1989; =-=Meertens, 1983-=-) to arbitrary regular datatypes. For finite lists, the universal property of fold can be stated as the following equivalence between two definitions for a function g that processes lists: g [ ] = v g... |

92 | Shortcut to Deforestation in Calculational Form - Takano, Meijer - 1995 |

89 | Algebra of programming - Bird, Moor - 1997 |

84 | Generic programming — an introduction
- Backhouse, Jansson, et al.
- 1999
(Show Context)
Citation Context ...ly under development (de Moor & Sittampalan, 1998). Polytypic programming. Defining programs that are not specific to particular datatypes has given rise to a new field, called polytypic programming (=-=Backhouse et al., 1998-=-). Formally, a polytypic program is one that is parameterised by one or more datatypes. Polytypic programs have already been defined for a number of applications, including pattern matching (Jeuring, ... |

84 |
Algebraic data types and program transformation
- Malcolm
- 1990
(Show Context)
Citation Context ...c to lists, but can be generalised in a uniform way to `regular' datatypes. Indeed, using ideas from category theory, a single fold operator can be defined that can be used with any regular datatype (=-=Malcolm, 1990-=-b; Meijer et al., 1991; Sheard & Fegaras, 1993). Fold for nested datatypes. The fold operator can also be generalised in a natural way to `nested' datatypes. However, the resulting operator appears to... |

81 | Nested datatypes
- Bird, Meertens
- 1998
(Show Context)
Citation Context ... on recursion operators that we do not have space to pursue here. The article is aimed at a reader who is familiar with the basics of functional programming, say to the level of (Bird & Wadler, 1988; =-=Bird, 1998-=-). All programs in the article are written in Haskell (Peterson et al. , 1997), the standard lazy functional programming language. However, no special features of Haskell are used, and the ideas can e... |

74 | Warm fusion: deriving build-catas from recursive definitions - Launchbury, Sheard - 1995 |

71 |
Three approaches to type structure
- Reynolds
- 1985
(Show Context)
Citation Context ...ic example of a function that is not primitive recursion in a firstorder programming language. However, in a higher-order language such as Haskell, Ackermann's function is indeed primitive recursive (=-=Reynolds, 1985-=-). In this section we show how to calculate the definition ack in terms of fold . First of all, by appealing to the universal property of fold , the equation ack = fold f v is equivalent to the follow... |

49 | Merging monads and folds for functional programming
- Meijer, Jeuring
- 1995
(Show Context)
Citation Context ... structures in programs (deforestation) in considerably simplified when programs are written using recursion operators rather than general recursion (Wadler, 1981; Launchbury & Sheard, 1995; Takano & =-=Meijer, 1995-=-). A generic system for transforming programs written using recursion operators is currently under development (de Moor & Sittampalan, 1998). Polytypic programming. Defining programs that are not spec... |

43 |
Calculating Compilers
- Meijer
- 1992
(Show Context)
Citation Context ...le, any pair of applications of fold to the same list can always be combined to give a single application of fold that generates a pair, by appealing to the so-called `banana split' property of fold (=-=Meijer, 1992-=-). The strange name of this property derives from the fact that the fold operator is sometimes written using brackets (j j) that resemble bananas, and the pairing operator is sometimes called split. H... |

43 | Designing and Implementing Combinator Languages - Swierstra, Alocer, et al. - 1999 |

30 | G.: Generic program transformation - Moor, Sittampalam - 1998 |

28 | Polytypic pattern matching
- Jeuring
- 1995
(Show Context)
Citation Context ...ion of a `monadic fold' combines the use of fold operators to structure the processing of recursive values with the use of monads to structure the use of imperative features (Fokkinga, 1994; Meijer & =-=Jeuring, 1995-=-). Relational fold. The fold operator can also be generalised in a natural way from functions to relations. This generalisation supports the use of fold as a specification construct, in addition to it... |

26 |
Monadic Maps and Folds for Arbitrary Datatypes. Memoranda Informatica 94-28
- Fokkinga
- 1994
(Show Context)
Citation Context ...ing on this work, the notion of a `monadic fold' combines the use of fold operators to structure the processing of recursive values with the use of monads to structure the use of imperative features (=-=Fokkinga, 1994-=-; Meijer & Jeuring, 1995). Relational fold. The fold operator can also be generalised in a natural way from functions to relations. This generalisation supports the use of fold as a specification cons... |

26 | Designing designing - Jones - 1979 |

23 | About charity - Cockett, Fukushima - 1992 |

23 | Fold and unfold for program semantics
- Hutton
- 1998
(Show Context)
Citation Context ...g rather than processing recursive values has been used for specification purposes (Jones, 1990; Bird & de Moor, 1997), to program reactive systems (Kieburtz, 1998), to program operational semantics (=-=Hutton, 1998-=-), and is the subject of current research. Other interesting recursion operators include the so-called paramorphisms (Meertens, 1992), hylomorphisms (Meijer, 1992), and zygomorphisms (Malcolm, 1990a).... |

23 | Introduction to Functional Programming using - Bird - 1998 |

19 | Polytypic unification - Jansson, Jeuring - 1998 |

19 | Designing circuits by calculation
- Jones
- 1990
(Show Context)
Citation Context ...rts the use of fold as a specification construct, in addition to its use as a programming construct. For example, a relational fold is used in the circuit design calculus Ruby (Jones & Sheeran, 1990; =-=Jones, 1990-=-), the Eindhoven spec calculus (Aarts et al., 1992), and in a recent textbook on the algebra of programming (Bird & de Moor, 1997). Other recursion operators. The fold operator is not the only useful ... |

8 | Algebraic Design Language (preliminary definition - Kieburtz, Lewis - 1994 |

7 |
Applicative style programming, program transformation, and list operators
- Wadler
- 1981
(Show Context)
Citation Context ... example, eliminating the use of intermediate data structures in programs (deforestation) in considerably simplified when programs are written using recursion operators rather than general recursion (=-=Wadler, 1981-=-; Launchbury & Sheard, 1995; Takano & Meijer, 1995). A generic system for transforming programs written using recursion operators is currently under development (de Moor & Sittampalan, 1998). Polytypi... |

6 | Reactive functional programming
- Kieburtz
- 1998
(Show Context)
Citation Context ...r example, the dual operator unfold for constructing rather than processing recursive values has been used for specification purposes (Jones, 1990; Bird & de Moor, 1997), to program reactive systems (=-=Kieburtz, 1998-=-), to program operational semantics (Hutton, 1998), and is the subject of current research. Other interesting recursion operators include the so-called paramorphisms (Meertens, 1992), hylomorphisms (M... |

5 | Paramorphisms
- Meertens
- 1992
(Show Context)
Citation Context ...airs the desired result with the argument list, we have now shown how the function dropWhile can be redefined in terms of fold , as required. In fact, this result is an instance of a general theorem (=-=Meertens, 1992-=-) that states that any function on finite lists that is defined by pairing the desired result with the argument list can always be redefined in terms of fold , although not always in a way that does n... |

4 |
Translating attribute grammars into catamorphisms
- Fokkinga, Jeuring, et al.
- 1991
(Show Context)
Citation Context ...! g (n + x))) id xs 0 We end this section by remarking that the use of fold to generate functions provides an elegant technique for the implementation of `attribute grammars' in functional languages (=-=Fokkinga et al., 1991-=-; Swierstra et al., 1998). 5.1 The foldl operator Now let us generalise from the suml example and consider the standard operator foldl that processes the elements of a list in left-to-right order by u... |

3 |
Circuit design in Ruby. Staunstrup (ed), Formal methods for VLSI design
- Jones, Sheeran
- 1990
(Show Context)
Citation Context ...rts the use of fold as a specification construct, in addition to its use as a programming construct. For example, a relational fold is used in the circuit design calculus Ruby (Jones & Sheeran, 1990; =-=Jones, 1990-=-), the Eindhoven spec calculus (Aarts et al., 1992), and in a recent textbook on the algebra of programming (Bird & de Moor, 1997). Other recursion operators. The fold operator is not the only useful ... |

2 |
A relational theory of datatypes. Available on the World-Wide-Web: http://www.win.tue.nl/win/cs/wp/papers/papers.html
- Aarts, Backhouse, et al.
- 1992
(Show Context)
Citation Context ...truct, in addition to its use as a programming construct. For example, a relational fold is used in the circuit design calculus Ruby (Jones & Sheeran, 1990; Jones, 1990), the Eindhoven spec calculus (=-=Aarts et al., 1992-=-), and in a recent textbook on the algebra of programming (Bird & de Moor, 1997). Other recursion operators. The fold operator is not the only useful recursion operator. For example, the dual operator... |

2 | Revisiting catemorphisms over datatypes with embedded tutorial on the universality and expressiveness of fold 371 functions - Fegaras, Sheard - 1996 |

2 | A pragmatic approach to maps and folds for parameterized datatypes - Jones, Blampied - 1998 |

2 | The Haskell language report, version 1.4. Available on the World-Wide-Web from http://www.haskell.org - Peterson - 1997 |

1 | Reactive functional programming - Chapman, Hall - 1998 |

1 |
A tutorial on the universality and expressiveness of fold 17
- Kieburtz, Lewis
- 1994
(Show Context)
Citation Context ...ges. A number of experimental programming languages have been developed that focus on the use of recursion operators rather than general recursion. Examples include the algebraic design language ADL (=-=Kieburtz & Lewis, 1994-=-), the categorical programming language Charity (Cockett & Fukushima, 1992), and the polytypic programming language PolyP (Jansson & Jeuring, 1997). 7 Acknowledgements I would like to thank Erik Meije... |