#### DMCA

## A Tutorial on the Universality and Expressiveness of Fold (1993)

### Cached

### Download Links

- [www.cs.nott.ac.uk]
- [www.cs.nott.ac.uk]
- [www.cs.nott.ac.uk]
- [www.cs.nott.ac.uk]
- [www.cs.nott.ac.uk]
- [www.cs.nott.ac.uk]
- DBLP

### Other Repositories/Bibliography

Venue: | Journal of Functional Programming |

Citations: | 68 - 12 self |

### Citations

1487 | Monads for functional programming. In:
- Wadler
- 1995
(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... |

1275 | The Lambda Calculus: Its Syntax and Semantics. - Barendregt - 1981 |

940 |
Introduction to Metamathematics.
- 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... |

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

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

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

277 |
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) = ... |

261 |
Introduction to Functional Programming using Haskell,
- Bird
- 1988
(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... |

188 | PolyP - a polytypic programming language extension. - Jansson, Jeuring - 1997 |

176 |
The Lambda Calculus: its syntax and semantics. North Holland,
- 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... |

117 | A fold for all seasons. - Sheard, Fegaras - 1993 |

110 | Algebra of Programming. - Bird, Moor - 1996 |

104 | Shortcut Deforestation in Calculational Form. - Takano, Meijer - 1995 |

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

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

90 | 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, ... |

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

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

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

76 | Warm fusion: Deriving build-catas from recursive definitions. - Launchbury, Sheard - 1995 |

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

49 | Designing and implementing combinator languages. - Swierstra, Azero, et al. - 1999 |

45 |
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 | Fashion Design, - Jones - 2002 |

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

27 |
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 | About charity. - Cockett, Fukushima - 1992 |

25 | Introduction to Functional Programming using - BIRD - 1998 |

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

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

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

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

7 | Reactive Functional Programming
- Kieburtz
(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... |

6 | Paramorphisms
- Meertens
- 1990
(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... |