## Calculating Functional Programs (2000)

### Cached

### Download Links

- [web.comlab.ox.ac.uk]
- [www.cse.iitb.ac.in]
- DBLP

### Other Repositories/Bibliography

Venue: | Algebraic and Coalgebraic Methods in the Mathematics of Program Construction, volume 2297 of LNCS, chapter 5 |

Citations: | 27 - 8 self |

### BibTeX

@INPROCEEDINGS{Gibbons00calculatingfunctional,

author = {Jeremy Gibbons},

title = {Calculating Functional Programs},

booktitle = {Algebraic and Coalgebraic Methods in the Mathematics of Program Construction, volume 2297 of LNCS, chapter 5},

year = {2000},

pages = {148--203},

publisher = {Springer-Verlag}

}

### OpenURL

### Abstract

A good way of developing a correct program is to calculate it from its specification. Functional programming languages are especially suitable for this, because their referential transparency greatly helps calculation. We discuss the ideas behind program calculation, and illustrate with an example (the maximum segment sum problem). We show that calculations are driven by promotion, and that promotion properties arise from universal properties of the data types involved. 1 Context The history of computing is a story of two contrasting trends. On the one hand, the cost and cost/performance ratio of computer hardware plummets; on the other, computer software is over-complex, unreliable and almost inevitably over budget. Clearly, we have learnt how to build computers, but not yet how to program them. It is now widely accepted that ad-hoc approaches to constructing software break down as projects get more ambitious. A more formal approach, based on sound mathematical foundations, i...

### Citations

301 | Functional programming with bananas, lenses, envelopes and barbed wire
- Meijer, Fokkinga, et al.
- 1991
(Show Context)
Citation Context ...r lists. Malcolm [10] shows that the same applies to any suitable datatype: there is a `fold' and a `universal property', and these arise for free from the datatype definition. Moreover, Meijer et al =-=[12]-=- and others have shown that similar results hold for a dual of folds, called unfolds; instead of collapsing a data structure to a value, as folds do, unfolds generate a data structure from a value; th... |

216 |
An introduction to the theory of lists
- Bird
- 1987
(Show Context)
Citation Context ...ity conditions, so that the flow of the calculation need not be interrupted. Inductive proofs are eschewed as far as possible. The calculus that we have in mind, the so-called Bird-Meertens Formalism =-=[4, 11]-=-, uses ideas from universal algebra and category theory to provide such a body of theorems. In particular, the theorems arise as properties of common patterns of computation over the data structures c... |

163 |
Programming Pearls
- Bentley
- 2000
(Show Context)
Citation Context ...m segment sum of a list of num3 bers. This is a classical problem in programming texts, largely because it is a simple problem with a very elegant yet not at all obvious linear-time solution. Bentley =-=[2]-=- uses it as an argument for the benefits of algorithm design, developing in turn cubic, quadratic, O(n log n) and linear algorithms. Kaldewaij [9], among others, use it as we do, as an illustration of... |

105 |
Data structures and program transformation
- Malcolm
- 1990
(Show Context)
Citation Context ... sum . inits = foldr f 0 where f a b = max 0 (a + b) and, with this f, mss = maximum . scanr f 0 3 Looking forward We have shown how folds are the fundamental pattern of recursion over lists. Malcolm =-=[10]-=- shows that the same applies to any suitable datatype: there is a `fold' and a `universal property', and these arise for free from the datatype definition. Moreover, Meijer et al [12] and others have ... |

96 |
de Moor, O.: Algebras of Programming
- Bird
- 1996
(Show Context)
Citation Context ...r under-determined; also, many problems are most naturally specified using inverses, which do not come naturally in the functional 8 world. In answer to this, Backhouse et al [1] and Bird and de Moor =-=[3]-=- are working on calculi for calculating relational programs. It remains to be seen whether it is worth paying the extra complexity for the extra generality and power provided by relational languages. ... |

95 |
Algorithmics â€“towards programming as a mathematical activity
- Meertens
- 1986
(Show Context)
Citation Context ...ity conditions, so that the flow of the calculation need not be interrupted. Inductive proofs are eschewed as far as possible. The calculus that we have in mind, the so-called Bird-Meertens Formalism =-=[4, 11]-=-, uses ideas from universal algebra and category theory to provide such a body of theorems. In particular, the theorems arise as properties of common patterns of computation over the data structures c... |

81 | Circuit design in Ruby - Jones, Sheeran - 1990 |

69 | Foundations of Parallel Programming - Skillicorn - 1994 |

58 |
Algebraic identities for program calculation
- Bird
- 1989
(Show Context)
Citation Context ...ing in turn cubic, quadratic, O(n log n) and linear algorithms. Kaldewaij [9], among others, use it as we do, as an illustration of program calculation; in particular, this development is inspired by =-=[5]-=-. We use the notation of Gofer [8], but we introduce the necessary notation as we go along. 2.1 The problem Given a list of numbers, the maximum segment sum problem is to compute the maximum of the su... |

53 |
Programming: the derivation of algorithms
- Kaldewaij
- 1990
(Show Context)
Citation Context ... yet not at all obvious linear-time solution. Bentley [2] uses it as an argument for the benefits of algorithm design, developing in turn cubic, quadratic, O(n log n) and linear algorithms. Kaldewaij =-=[9]-=-, among others, use it as we do, as an illustration of program calculation; in particular, this development is inspired by [5]. We use the notation of Gofer [8], but we introduce the necessary notatio... |

36 | A Relational Theory of Datatypes
- Backhouse, Hoogendijk, et al.
- 1992
(Show Context)
Citation Context ...on is non-deterministic or under-determined; also, many problems are most naturally specified using inverses, which do not come naturally in the functional 8 world. In answer to this, Backhouse et al =-=[1]-=- and Bird and de Moor [3] are working on calculi for calculating relational programs. It remains to be seen whether it is worth paying the extra complexity for the extra generality and power provided ... |

7 |
An introduction to the Bird-Meertens Formalism
- Gibbons
- 1994
(Show Context)
Citation Context ...paper appeared as An Introduction to the Bird-Meertens Formalism, in Proceedings of the New Zealand Formal Program Development Colloquium, edited by Steve Reeves, Hamilton, New Zealand, November 1994 =-=[6]-=-. 1 constructing a high-quality program in the first place. A better approach is program derivation, whereby the correctness requirements of a program are gradually transformed, by the application of ... |