{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/memoisation-purely-left-recursively-and-with","title":"Memoisation: Purely, Left-recursively, and with (Continuation Passing) Style","arxiv_id":"1707.04724","date":"2017-07-15","proceeding":null,"authors":["Samer Abdallah"],"abstract":"Memoisation, or tabling, is a well-known technique that yields large\nimprovements in the performance of some recursive computations. Tabled\nresolution in Prologs such as XSB and B-Prolog can transform so called\nleft-recursive predicates from non-terminating computations into finite and\nwell-behaved ones. In the functional programming literature, memoisation has\nusually been implemented in a way that does not handle left-recursion,\nrequiring supplementary mechanisms to prevent non-termination. A notable\nexception is Johnson's (1995) continuation passing approach in Scheme. This,\nhowever, relies on mutation of a memo table data structure and coding in\nexplicit continuation passing style. We show how Johnson's approach can be\nimplemented purely functionally in a modern, strongly typed functional language\n(OCaml), presented via a monadic interface that hides the implementation\ndetails, yet providing a way to return a compact represention of the memo\ntables at the end of the computation.","url_abs":"http://arxiv.org/abs/1707.04724v1","url_pdf":"http://arxiv.org/pdf/1707.04724v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"memoisation-purely-left-recursively-and-with","repo_url":"https://github.com/samer--/cpsmemo","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"none","reach":null}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":null,"mcp":null,"developers":"https://syntology.ai/developers"},"arxiv_metadata":null,"syntology_extracted_results":null}