Skip to main content

Histo− and Dynamorphisms Revisited

Ralf Hinze and Nicolas Wu

Abstract

Dynamic programming algorithms embody a widely used programming technique that optimizes recursively defined equations that have repeating subproblems. The standard solution uses arrays to share common results between successive steps, and while effective, this fails to exploit the structural properties present in these problems. Histomorphisms and dynamorphisms have been introduced to expresses such algorithms in terms of structured recursion schemes that leverage this structure. In this paper, we revisit and relate these schemes and show how they can be expressed in terms of recursion schemes from comonads, as well as from recursive coalgebras. Our constructions rely on properties of bialgebras and dicoalgebras, and we are careful to consider optimizations and efficiency concerns. Throughout the paper we illustrate these techniques through several worked-out examples discussed in a tutorial style, and show how a recursive specification can be expressed both as an array-based algorithm as well as one that uses recursion schemes.

Address
New York‚ NY‚ USA
Book Title
Proceedings of the 9th ACM SIGPLAN Workshop on Generic Programming
Editor
Carette‚ Jacques and Willcock‚ Jeremiah
ISBN
978−1−4503−2389−5
Location
Boston‚ Massachusetts‚ USA
Pages
1–12
Publisher
ACM
Series
WGP '13
Year
2013