skip to main content
10.1145/1159803.1159835acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Algebraic fusion of functions with an accumulating parameter and its improvement

Published:16 September 2006Publication History

ABSTRACT

We present a unifying solution to the problem of fusion of functions, where both the producer function and the consumer function have one accumulating parameter. The key idea in this development is to formulate the producer function as a function which computes over a monoid of data contexts. Upon this formulation, we develop a fusion method called algebraic fusion based on the elementary theory of universal algebra and monoids. The producer function is fused with a monoid homomorphism that is derived from the definition of the consumer function, and is turned into a higher-order function f that computes over the monoid of endofunctions.We then introduce a general concept called improvement, in order to reduce the cost of computing over the monoid of endofunctions (i. e., function closures). An improvement of the function f via a monoid homomorphism h is a function g that satisfies f =h ºg. This provides a principled way of finding a first-order function representing a solution to the fusion problem. It also presents a clean and unifying account for varying fusion methods that have been proposed so far. Furthermore, we show that our method extends to support partial and infinite data structures, by means of an appropriate monoid structure.

References

  1. S. Abramsky. Retracting some paths in process algebra. In CONCUR '96, Concurrency Theory, 7th International Conference, Pisa, Italy, August 26-29, 1996, Proceedings, volume 1119 of LNCS, pages 1--17. Springer, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. R.M. Burstall and J. Darlington. A transformation system for developing recursive programs. Journal of ACM, 24(1):44--67, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. W.-N. Chin. Safe fusion of functional expressions II: Further improvements. Journal of Functional Programming, 4(4):515--555, 1994.Google ScholarGoogle ScholarCross RefCross Ref
  4. Z. Fülöp and H. Vogler. Syntax-Directed Semantics, Formal Models Based on Tree Transducers. Springer Verlag, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. H. Ganzinger and R. Giegerich. Attribute coupled grammars. In Proceedings of the ACM SIGPLAN '84 Symposium on Compiler Construction, volume 19(6) of SIGPLAN Notices, pages 157--170, June 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. N. Ghani, P. Johann, T. Uustalu, and V. Vene. Monadic augment and generalised short cut fusion. In International Conference on Functional Programming (ICFP '05), pages 294--305. ACM Press, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. N. Ghani, T. Uustalu, and V. Vene. Generalizing the augment combinator. In Trends in Functional Programming 5, pages 65--78. Intellect, 2006.Google ScholarGoogle Scholar
  8. A. Gill. Cheap Deforestation for Non-strict Functional Languages. PhD thesis, University of Glasgow, 1996.Google ScholarGoogle Scholar
  9. A. Gill, J. Launchbury, and S. Peyton Jones. A short cut to deforestation. In Proc. of the Conference on Functional Programming Languages and Computer Architecture, pages 223--232. ACM Press, June 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J.A. Goguen, J.W. Thatcher, E.G. Wagner, and J.B. Wright. Initial algebra semantics and continuous algebras. J. ACM, 24(1):68--95, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. P. Johann. A generalization of short-cut fusion and its correctness proof. Higher-Order and Symbolic Computation, 15 4):273--300, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. A. Joyal, R. Street, and D. Verity. Traced monoidal categories. In Math. Proc. Camb. Phil. Soc., pages 447--468, 1996.Google ScholarGoogle ScholarCross RefCross Ref
  13. K. Kakehi, R. Glück, and Y. Futamura. On deforesting parameters of accumulating maps. In Logic Based Program Synthesis and Transformation, 11th International Workshop, LOPSTR 2001, volume 2372 of LNCS, pages 46--56. Springer Verlag, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Q. Ma and J.C. Reynolds. Types, abstractions, and parametric polymorphism, part 2. In Proc. of Mathematical Foundations of Programming Semantics (MFPS 1991), volume 598 of LNCS, pages 1--40. Springer Verlag, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. G. Malcolm. Homomorphisms and promotability. In Mathematics of Program Construction, volume 375 of LNCS, pages 335--347. Springer Verlag, 1989. Google ScholarGoogle Scholar
  16. S. Nishimura. Correctness of a higher-order removal transformation through a relational reasoning. In Programming Language and Systems, First Asian Symposium, APLAS 2003 Proceedings, volume 2895 of LNCS, pages 358--375. Springer Verlag, 2003.Google ScholarGoogle Scholar
  17. S. Nishimura. Fusion with stacks and accumulating parameters. In Proc. of the 2004 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pages 101--112. ACM Press, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. T. Sheard and L. Fegaras. A fold for all seasons. In International Conference on Functional Programming Languages and Computer Architecture (FPCA'93), pages 233--242. ACM Press, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. A. Takano and E. Meijer. Shortcut deforestation in calculational form. In Proc. of International Conference on Functional Programming Languages and Computer Architecture (FPCA'95), pages 306--313. ACM Press, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. J. Voigtländer. Using circular programs to deforest in accumulating parameters. Higher-Order and Symbolic Computation, 17(1), 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. P. Wadler. Theorems for free! In International Conference on Functional Programming and Computer Architecture (FPCA'89), pages 347--359. Addison-Wesley, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. P. Wadler. Deforestation: transforming programs to eliminate trees. Theoretical Computer Science, 73(2):231--248, June 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Algebraic fusion of functions with an accumulating parameter and its improvement

            Recommendations

            Comments

            Login options

            Check if you have access through your login credentials or your institution to get full access on this article.

            Sign in

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader
            About Cookies On This Site

            We use cookies to ensure that we give you the best experience on our website.

            Learn more

            Got it!