A monadic approach for avoiding code duplication when staging memoized functions

Kedar Swadi, Walid Taha, Oleg Kiselyov, Emir Pasalic

Research output: Chapter in Book/Report/Conference proceedingConference contribution

29 Citations (Scopus)

Abstract

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 undoes the 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.

Original languageEnglish
Title of host publicationPEPM 2006
Subtitle of host publicationProceedings of the Workshop on Partial Evaluation and Program Manipulation
Pages160-169
Number of pages10
DOIs
Publication statusPublished - 2006 Dec 1
Externally publishedYes
Event2006 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation - Charleston, SC, United States
Duration: 2006 Jan 92006 Jan 10

Publication series

NameProceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation

Other

Other2006 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation
CountryUnited States
CityCharleston, SC
Period06/1/906/1/10

Keywords

  • Code duplication
  • Fixed points
  • Monads
  • Multi-stage programming
  • Partial evaluation
  • Program generation
  • Program specialization
  • Staging

ASJC Scopus subject areas

  • Software

Fingerprint Dive into the research topics of 'A monadic approach for avoiding code duplication when staging memoized functions'. Together they form a unique fingerprint.

  • Cite this

    Swadi, K., Taha, W., Kiselyov, O., & Pasalic, E. (2006). A monadic approach for avoiding code duplication when staging memoized functions. In PEPM 2006: Proceedings of the Workshop on Partial Evaluation and Program Manipulation (pp. 160-169). (Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation). https://doi.org/10.1145/1111542.1111570