Manipulating accumulative functions by swapping call-time and return-time computations

作者:Morihata Akimasa*; Kakehi Kazuhiko; Hu Zhenjiang; Takeichi Masato
来源:Journal of Functional Programming, 2012, 22(3): 275-299.
DOI:10.1017/S0956796812000111

摘要

Functional languages are suitable for transformational developments of programs. However, accumulative functions, or in particular tail-recursive functions, are known to be less suitable for manipulation. In this paper, we propose a program transformation named "IO swapping" that swaps call-time and return-time computations. It moves computations in accumulative parameters to results and thereby enables interesting transformations. We demonstrate effectiveness of IO swapping by several applications: deforestation, higher order removal, program inversion, and manipulation of circular programs.

  • 出版日期2012-5

全文