ABSTRACT
This paper proposes a lightweight fusion method for general recursive function definitions. Compared with existing proposals, our method has several significant practical features: it works for general recursive functions on general algebraic data types; it does not produce extra runtime overhea (except for possible code size increase due to the success of fusion); and it is readily incorporated in standard inlining optimization. This is achieved by extending the ordinary inlining process with a new fusion law that transforms a term of the form f o (fixgλx.E) to a new fixed point term fixhλx.E′ by promoting the function f through the fixed point operator. This is a sound syntactic transformation rule that is not sensitive to the types of f and g. This property makes our method applicable to wide range of functions including those with multi-parameters in both curried and uncurried forms. Although this method does not guarantee any form of completeness, it fuses typical examples discussed in the literature and others that involve accumulating parameters, either in the tt foldl-like specific forms or in general recursive forms, without any additional machinery. In order to substantiate our claim, we have implemented our method in a compiler. Although it is preliminary, it demonstrates practical feasibility of this method.
- R. Burstall and J. Darlington. A transformation system for developing recursive programs. Journal of the ACM, 24(1):44--67, 1977. Google Scholar
Digital Library
- M. Chakravarty and G. Keller. Functional array fusion. In Proc. ACM International Conference on Functional Programming, pages 205--216, 2001. Google Scholar
Digital Library
- W-N. Chin. Safe fusion on functional expression. In Proc. ACM Conference on Lisp and Functional Programming, pages 11--20, 1992. Google Scholar
Digital Library
- O. Chitil. Type inference builds a short cut to deforestation. In Proc. ACM International Conference on Functional Programming, pages 249--260, 1999. Google Scholar
Digital Library
- N. Ghani, P. Johann, T. Uustalu, and V. Vene. Monadic augment and generalised short cut fusion. In Proc. ACM International Conference on Functional Programming, pages 294--305, 2005. Google Scholar
Digital Library
- A. Gill, J. Launchbury, and S. Peyton Jones. A short cut to deforestation. In Proc. International Conference on Functional Programming Languages and Computer Architecture, pages 223--232, 1993. Google Scholar
Digital Library
- A. Gill. Cheap Deforestation for Non-strict Functional Languages. Ph.D thesis, University of Glasgow, 1996.Google Scholar
- M. Hasegawa and Y. Kakutani. Axioms for recursion in call-by-value. Higher-Order and Symbolic Computation, 15(2-3):235--264, 2002. Google Scholar
Digital Library
- Z. Hu, H. Iwasaki, and M. Takeichi. Deriving structural hylomorphisms from recursive definitions. In Proc. ACM International Conference on Functional Programming, pages 73--82, 1996. Google Scholar
Digital Library
- P. Johann and E. Visser. Warm fusion in Stratego: A case study in generation of program transformation systems. Annals of Mathematics and Artificial Intelligence, 29(1-4):1--34, 2000. Google Scholar
Digital Library
- S. Katsumata and S. Nishimura. Algebraic fusion of functions with an accumulating parameter and its improvement. In Proc. ACM International Conference on Functional Programming, pages 227--238, 2006. Google Scholar
Digital Library
- J. Launchbury and T. Sheard. Warm fusion: Deriving build-catas from recursive definitions. In Proc. ACM Conference on Functional Programming Languages and Computer Architecture, pages 314--323, 1995. Google Scholar
Digital Library
- G. Malcolm. Homomorphism and promotability. In Proc. Mathematics of Program Construction, pages 335--347, 1989. Google Scholar
Digital Library
- E. Meijer, M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In Proc. International Conference on Functional Programming Languages and Computer Architecture (FPCA'91), Lecture Notes in Computer Science 523, pages 124--144, 1991. Google Scholar
Digital Library
- L. Nemeth and S. Peyton Jones. A design for warm fusion. In Proc. International Workshop on Implementation of Functional Languages, pages 381--393, 1998.Google Scholar
- Y. Onoue, Z. Hu, H. Iwasaki, and M. Takeichi. Verification of practical effectiveness of program fusion (in Japanese). Computer Software, 17(3):81--85, 2000.Google Scholar
- S. Peyton Jones, A. Tolmach, and T. Hoare. Playing by the rules: rewriting as a practical optimisation technique in GHC. In Proc. ACM Haskell workshop, 2001.Google Scholar
- D. Sands. Proving the correctness of recursion-based automatic program transformations. Theoretical Computer Science, 167(1-2):193--233, 1996. Google Scholar
Digital Library
- T. Sheard and L. Fegaras. A fold for all seasons. In Proc. Functional Programming Languages and Computer Architecture, pages 233--242, 1993. Google Scholar
Digital Library
- SML# home page. http://www.riec.tohoku.ac.jp/smlsharp/, 2006.Google Scholar
- J. Svenningsson. Shortcut fusion for accumulating parameters & zip-like functions. In Proc. ACM International Conference on Functional Programming, pages 124--132, 2002. Google Scholar
Digital Library
- A. Takano and E. Meijer. Shortcut deforestation in calculational form. In Proc. ACM/IFIP Conference on Functional Programming Languages and Computer Architecture, pages 306--313, 1995. Google Scholar
Digital Library
- P. Wadler. Deforestation: transforming programs to eliminate trees. Theoretical Computer Science, 73:231--248, 1990. Special issue of selected papers from 2'nd European Symposium on Programming. Google Scholar
Digital Library
Index Terms
Lightweight fusion by fixed point promotion
Recommendations
Lightweight fusion by fixed point promotion
Proceedings of the 2007 POPL ConferenceThis paper proposes a lightweight fusion method for general recursive function definitions. Compared with existing proposals, our method has several significant practical features: it works for general recursive functions on general algebraic data types;...
Two generalizations of some fixed point theorems
The aim of this paper is to generalize two classical fixed point theorems given by Bogin [J. Bogin, A generalization of a fixed point theorem of Goebel, Kirk and Shimi, Canad. Math. Bull. 19 (1976) 7-12] and Gregus [M. Gregus, A fixed point theorem in ...
Continuous selection theorems and fixed point theorems for fuzzy mappings in FC-spaces
FSKD'09: Proceedings of the 6th international conference on Fuzzy systems and knowledge discovery - Volume 6Continuous selection theorem plays a key role in nonlinear problems arising in mathematics and applied science. Michael (1956) firstly established a famous continuous selection theorem. Browder (1968) proved a continuous selection theorem under the ...






Comments