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

07/15/2017
by   Samer Abdallah, et al.
0

Memoisation, or tabling, is a well-known technique that yields large improvements in the performance of some recursive computations. Tabled resolution in Prologs such as XSB and B-Prolog can transform so called left-recursive predicates from non-terminating computations into finite and well-behaved ones. In the functional programming literature, memoisation has usually been implemented in a way that does not handle left-recursion, requiring supplementary mechanisms to prevent non-termination. A notable exception is Johnson's (1995) continuation passing approach in Scheme. This, however, relies on mutation of a memo table data structure and coding in explicit continuation passing style. We show how Johnson's approach can be implemented purely functionally in a modern, strongly typed functional language (OCaml), presented via a monadic interface that hides the implementation details, yet providing a way to return a compact represention of the memo tables at the end of the computation.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/19/2021

Continuation-Passing Style, Defunctionalization, Accumulations, and Associativity

Context: Reynolds showed us how to use continuation-passing style and de...
research
07/04/2018

A Purely Functional Computer Algebra System Embedded in Haskell

We demonstrate how methods in Functional Programming can be used to impl...
research
08/29/2019

FunSeqSet: Towards a Purely Functional Data Structure for the Linearisation Case of Dynamic Trees Problem

Dynamic trees, originally described by Sleator and Tarjan, have been stu...
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...
research
03/29/2013

Formalizing the Confluence of Orthogonal Rewriting Systems

Orthogonality is a discipline of programming that in a syntactic manner ...
research
02/20/2023

Tail recursion transformation for invertible functions

Tail recursive functions allow for a wider range of optimisations than g...
research
05/26/2019

Programming with Applicative-like expressions

The fact that Applicative type class allows one to express simple parser...

Please sign up or login with your details

Forgot password? Click here to reset