Summary: | <p><strong>Context:</strong> Reynolds showed us how to use continuation-passing style and defunctionalization to transform a recursive interpreter for a language into an abstract machine for programs in that language. The same techniques explain other programming tricks, including zippers and accumulating parameters.</p>
<p><strong>Inquiry:</strong> Buried within all those applications there is usually a hidden appeal to the algebraic property of associativity. Approach: Our purpose in this paper is to entice associativity out of the shadows and into the limelight.</p>
<p><strong>Knowledge:</strong> We revisit some well-known applications (factorial, fast reverse, tree flattening, and a compiler for a simple expression language) to spotlight their dependence on associativity.</p>
<p><strong>Grounding:</strong> We replay developments of these programs through a series of program transformations and data refinements, justified by equational reasoning.</p>
<p><strong>Importance:</strong> Understanding the crucial role played by associativity clarifies when continuation-passing style and defunctionalization can help and when they cannot, and may prompt other applications of these techniques.</p>
|