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

TL;DR
This paper explores various approaches to memoisation, including purely functional, left-recursive, and continuation passing styles, demonstrating a novel implementation in OCaml that preserves functional purity and handles left-recursion effectively.
Contribution
It presents a purely functional implementation of Johnson's continuation passing memoisation approach in OCaml, handling left-recursion without mutation.
Findings
Purely functional memoisation can handle left-recursion effectively.
The OCaml implementation uses a monadic interface to abstract memo table details.
The approach enables compact representation of memo tables after computation.
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Advanced Database Systems and Queries · Formal Methods in Verification
