Algebraic fusion of functions with an accumulating parameter and its improvement

  • Authors:
  • Shin-ya Katsumata;Susumu Nishimura

  • Affiliations:
  • Kyoto University;Kyoto University

  • Venue:
  • Proceedings of the eleventh ACM SIGPLAN international conference on Functional programming
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

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.