A Monadic Approach for Avoiding Code Duplication when Staging Memoized Functions
2006 (English)In: PEPM '06 Proceedings of the 2006 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation, New York, NY: ACM Press, 2006, p. 160-169Conference paper, Published paper (Refereed)
Abstract [en]
Building program generators that do not duplicate generated code can be challenging. At the same time, code duplication can easily increase both generation time and runtime of generated programs by an exponential factor. We identify an instance of this problem that can arise when memoized functions are staged. Without addressing this problem, it would be impossible to effectively stage dynamic programming algorithms. Intuitively, direct staging undoesthe effect of memoization. To solve this problem once and for all, and for any function that uses memoization, we propose a staged monadic combinator library. Experimental results confirm that the library works as expected. Preliminary results also indicate that the library is useful even when memoization is not used.
Place, publisher, year, edition, pages
New York, NY: ACM Press, 2006. p. 160-169
Keywords [en]
Staging, Monads, Fixed points, Code duplication, Program specialization, Multi-stage programming, Partial evaluation, Program generation
National Category
Computer Systems
Identifiers
URN: urn:nbn:se:hh:diva-20972DOI: 10.1145/1111542.1111570Scopus ID: 2-s2.0-34250646270ISBN: 1595931961 ISBN: 978-159593196-2 OAI: oai:DiVA.org:hh-20972DiVA, id: diva2:588269
Conference
PEPM'06. International Symposium on Partial Evaluation and Semantics Based Program Manipulation, Charleston, South Carolina, USA, January 9–10
2013-01-152013-01-142021-05-11Bibliographically approved