Histo- and dynamorphisms revisited

Ralf Hinze, Nicolas Wu
2013 Proceedings of the 9th ACM SIGPLAN workshop on Generic programming - WGP '13  
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
more » ... 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.
doi:10.1145/2502488.2502496 dblp:conf/icfp/HinzeW13 fatcat:o7vaczc4mve4lczjl5ap4iewde