Book contents
- Frontmatter
- Contents
- Preface
- 1 The smallest free number
- 2 A surpassing problem
- 3 Improving on saddleback search
- 4 A selection problem
- 5 Sorting pairwise sums
- 6 Making a century
- 7 Building a tree with minimum height
- 8 Unravelling greedy algorithms
- 9 Finding celebrities
- 10 Removing duplicates
- 11 Not the maximum segment sum
- 12 Ranking suffixes
- 13 The Burrows–Wheeler transform
- 14 The last tail
- 15 All the common prefixes
- 16 The Boyer–Moore algorithm
- 17 The Knuth–Morris–Pratt algorithm
- 18 Planning solves the Rush Hour problem
- 19 A simple Sudoku solver
- 20 The Countdown problem
- 21 Hylomorphisms and nexuses
- 22 Three ways of computing determinants
- 23 Inside the convex hull
- 24 Rational arithmetic coding
- 25 Integer arithmetic coding
- 26 The Schorr–Waite algorithm
- 27 Orderly insertion
- 28 Loopless functional algorithms
- 29 The Johnson–Trotter algorithm
- 30 Spider spinning for dummies
- Index
Preface
Published online by Cambridge University Press: 05 March 2013
- Frontmatter
- Contents
- Preface
- 1 The smallest free number
- 2 A surpassing problem
- 3 Improving on saddleback search
- 4 A selection problem
- 5 Sorting pairwise sums
- 6 Making a century
- 7 Building a tree with minimum height
- 8 Unravelling greedy algorithms
- 9 Finding celebrities
- 10 Removing duplicates
- 11 Not the maximum segment sum
- 12 Ranking suffixes
- 13 The Burrows–Wheeler transform
- 14 The last tail
- 15 All the common prefixes
- 16 The Boyer–Moore algorithm
- 17 The Knuth–Morris–Pratt algorithm
- 18 Planning solves the Rush Hour problem
- 19 A simple Sudoku solver
- 20 The Countdown problem
- 21 Hylomorphisms and nexuses
- 22 Three ways of computing determinants
- 23 Inside the convex hull
- 24 Rational arithmetic coding
- 25 Integer arithmetic coding
- 26 The Schorr–Waite algorithm
- 27 Orderly insertion
- 28 Loopless functional algorithms
- 29 The Johnson–Trotter algorithm
- 30 Spider spinning for dummies
- Index
Summary
In 1990, when the Journal of Functional Programming (JFP) was in the stages of being planned, I was asked by the then editors, Simon Peyton Jones and Philip Wadler, to contribute a regular column to be called Functional Pearls. The idea they had in mind was to emulate the very successful series of essays that Jon Bentley had written in the 1980s under the title “Programming Pearls” in the Communications of the ACM. Bentley wrote about his pearls:
Just as natural pearls grow from grains of sand that have irritated oysters, these programming pearls have grown from real problems that have irritated programmers. The programs are fun, and they teach important programming techniques and fundamental design principles.
I think the editors had asked me because I was interested in the specific task of taking a clear but inefficient functional program, a program that acted as a specification of the problem in hand, and using equational reasoning to calculate a more efficient one. One factor that stimulated growing interest in functional languages in the 1990s was that such languages were good for equational reasoning. Indeed, the functional language GOFER, invented by Mark Jones, captured this thought as an acronym. GOFER was one of the languages that contributed to the development of Haskell, the language on which this book is based. Equational reasoning dominates everything in this book.
- Type
- Chapter
- Information
- Pearls of Functional Algorithm Design , pp. ix - xiiPublisher: Cambridge University PressPrint publication year: 2010