Continuation-Passing Style, Defunctionalization, Accumulations, and Associativity

11/19/2021
by   Jeremy Gibbons, et al.
0

Context: 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. Inquiry: 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. Knowledge: 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. Grounding: We replay developments of these programs through a series of program transformations and data refinements, justified by equational reasoning. Importance: 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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/28/2021

Virtualizing Intermittent Computing

Intermittent computing requires custom programming models to ensure the ...
research
07/15/2017

Memoisation: Purely, Left-recursively, and with (Continuation Passing) Style

Memoisation, or tabling, is a well-known technique that yields large imp...
research
07/20/2023

The best multicore-parallelization refactoring you've never heard of

In this short paper, we explore a new way to refactor a simple but trick...
research
06/05/2019

Learning to Compose and Reason with Language Tree Structures for Visual Grounding

Grounding natural language in images, such as localizing "the black dog ...
research
08/16/2021

Automating the Functional Correspondence between Higher-Order Evaluators and Abstract Machines

The functional correspondence is a manual derivation technique transform...
research
06/28/2021

A Dictionary-Passing Translation of Featherweight Go

The Go programming language is an increasingly popular language but some...
research
07/07/2017

Complete Call-by-Value Calculi of Control Operators, I

We give new call-by-value calculi of control operators that are complete...

Please sign up or login with your details

Forgot password? Click here to reset