Results 1 -
5 of
5
Composition of functions with accumulating parameters
- Journal of Functional Programming
, 2004
"... Many functional programs with accumulating parameters are contained in the class of macro tree transducers. We present a program transformation technique that can be used to solve the efficiency problems due to creation and consumption of intermediate data structures in compositions of such function ..."
Abstract
-
Cited by 20 (9 self)
- Add to MetaCart
Many functional programs with accumulating parameters are contained in the class of macro tree transducers. We present a program transformation technique that can be used to solve the efficiency problems due to creation and consumption of intermediate data structures in compositions of such functions, where classical deforestation techniques fail. In order to do so, given two macro tree transducers under appropriate restrictions, we construct a single macro tree transducer that implements the composition of the two original ones. The imposed restrictions are more liberal than those in the literature on macro tree transducer composition, thus generalising previous results.
Using Circular Programs to Deforest in Accumulating Parameters
, 2002
"... Functional languages allow a modular programming style by function composition, which however can lead to inefficient runtime behavior due to production and consumption of intermediate results. We present a new mechanizable transformation technique for removing intermediate data structures in the co ..."
Abstract
-
Cited by 13 (4 self)
- Add to MetaCart
Functional languages allow a modular programming style by function composition, which however can lead to inefficient runtime behavior due to production and consumption of intermediate results. We present a new mechanizable transformation technique for removing intermediate data structures in the composition of two functions from a class of recursive functions with accumulating parameters, for which classical deforestation techniques fail. In order to avoid multiple traversals of the input data structure, the composition algorithm produces circular programs that make essential use of lazy evaluation and local recursion. The resulting programs are simplified using a post-processing phase presented in the paper.
Tree Transducer Composition as Deforestation Method for Functional Programs
, 2001
"... We demonstrate that composition techniques for tree transducers are suitable to eliminate intermediate results in functional programs. We consider two composition techniques, which view special functional programs as (restricted) macro tree transducers: The first uses composition techniques for macr ..."
Abstract
-
Cited by 5 (2 self)
- Add to MetaCart
We demonstrate that composition techniques for tree transducers are suitable to eliminate intermediate results in functional programs. We consider two composition techniques, which view special functional programs as (restricted) macro tree transducers: The first uses composition techniques for macro tree transducers directly. The second is indirect in that it (i) translates macro tree transducers into attributed tree transducers, (ii) uses a composition technique for attributed tree transducers, and (iii) translates the composition result back into a macro tree transducer. We informally compare these techniques with the deforestation technique of Wadler. In particular we show that the composition techniques eliminate intermediate results for certain kinds of function definitions, for which classical deforestation fails.
Deforesting in Accumulating Parameters via Type-Directed Transformations
- In: Asian Workshop on Programming Languages and Systems
, 2002
"... Classical deforestation methods fail to compose functions with accumulating parameters, which are function arguments to which intermediate result accumulates. This paper proposes a new deforestation method which solves this problem. The method is comprised of a few transformation steps, each of whic ..."
Abstract
-
Cited by 2 (0 self)
- Add to MetaCart
Classical deforestation methods fail to compose functions with accumulating parameters, which are function arguments to which intermediate result accumulates. This paper proposes a new deforestation method which solves this problem. The method is comprised of a few transformation steps, each of which is guided by type information. Though our solution draws its fundamental idea from a deforestation method that has been developed for attribute grammars, it is not merely a recast of an existing technique to another formalism. The new method provides a type-based account for the existing attribute grammar deforestation process. Further, it can deforest a class of functions that the attribute grammar deforestation cannot. These advantages are demonstrated by a few examples. It is also shown that the new method is as powerful as another method that has been developed for macro tree transducer composition.
Algebraic fusion of functions with an accumulating parameter and its improvement
- In Proc. ACM International Conference on Functional Programming
, 2006
"... 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 t ..."
Abstract
-
Cited by 1 (0 self)
- Add to MetaCart
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. Categories and Subject Descriptors D.3.2 [Programming Languages]: Language Classifications—Applicative (functional) languages;

