Results 1  10
of
20
Deforestation: Transforming programs to eliminate trees
 Theoretical Computer Science
, 1990
"... An algorithm that transforms programs to eliminate intermediate trees is presented. The algorithm applies to any term containing only functions with definitions in a given syntactic form, and is suitable for incorporation in an optimising compiler. Intermediate listsand, more generally, interm ..."
Abstract

Cited by 400 (5 self)
 Add to MetaCart
An algorithm that transforms programs to eliminate intermediate trees is presented. The algorithm applies to any term containing only functions with definitions in a given syntactic form, and is suitable for incorporation in an optimising compiler. Intermediate listsand, more generally, intermediate treesare both the basis and the bane of a certain style of programming in functional languages. For example, to compute the sum of the squares of the numbers from 1 to n, one could write the following program: sum (map square (upto 1 n)) (1) A key feature of this style is the use of functions (upto, map, sum) to encapsulate common patterns of computation ("consider the numbers from 1 to n ", "apply a function to each element", "sum a collection of elements"). Intermediate lists are the basis of this stylethey are the glue that holds the functions together. In this case, the list [1; 2; : : : ; n] connects upto to map, and the list [1; 4; : : : ; n 2 ] connects map to sum. B...
A Fold for All Seasons
 IN PROC. CONFERENCE ON FUNCTIONAL PROGRAMMING LANGUAGES AND COMPUTER ARCHITECTURE
, 1993
"... Generic control operators, such as fold, can be generated from algebraic type definitions. The class of types to which these techniques are applicable is generalized to all algebraic types definable in languages such as Miranda and ML, i.e. mutually recursive sumsofproducts with tuples and functio ..."
Abstract

Cited by 112 (15 self)
 Add to MetaCart
Generic control operators, such as fold, can be generated from algebraic type definitions. The class of types to which these techniques are applicable is generalized to all algebraic types definable in languages such as Miranda and ML, i.e. mutually recursive sumsofproducts with tuples and function types. Several other useful generic operators, also applicable to every type in this class, also are described. A normalization algorithm which automatically calculates improvements to programs expressed in a language based upon folds is described. It reduces programs, expressed using fold as the exclusive control operator, to a canonical form. Based upon a generic promotion theorem, the algorithm is facilitated by the explicit structure of fold programs rather than using an analysis phase to search for implicit structure. Canonical programs are minimal in the sense that they contain the fewest number of fold operations. Because of this property, the normalization algorithm has important ...
On perfect supercompilation
 Journal of Functional Programming
, 1996
"... We extend positive supercompilation to handle negative as well as positive information. This is done by instrumenting the underlying unfold rules with a small rewrite system that handles constraints on terms, thereby ensuring perfect information propagation. We illustrate this by transforming a na ..."
Abstract

Cited by 78 (3 self)
 Add to MetaCart
We extend positive supercompilation to handle negative as well as positive information. This is done by instrumenting the underlying unfold rules with a small rewrite system that handles constraints on terms, thereby ensuring perfect information propagation. We illustrate this by transforming a naively specialised string matcher into an optimal one. The presented algorithm is guaranteed to terminate by means of generalisation steps.
Warm Fusion: Deriving BuildCatas from Recursive Definitions
 In Conf. on Func. Prog. Languages and Computer Architecture
, 1995
"... Program fusion is the process whereby separate pieces of code are fused into a single piece, typically transforming a multipass algorithm into a single pass. Recent work has made it clear that the process is especially successful if the loops or recursions are expressed using catamorphisms (e.g.fol ..."
Abstract

Cited by 73 (2 self)
 Add to MetaCart
Program fusion is the process whereby separate pieces of code are fused into a single piece, typically transforming a multipass algorithm into a single pass. Recent work has made it clear that the process is especially successful if the loops or recursions are expressed using catamorphisms (e.g.foldr) and constructorabstraction (e.g. build). In this paper we show how to transform recursive programs into this form automatically, thus enabling the fusion transformation to be applied more easily than before. 1 Introduction There are significant advantages to multipass algorithms, in which intermediate datastructures are created and traversed. In particular, each of the passes may be relatively simple, so are both easier to write and are potentially more reusable. By separating many distinct phases it becomes possible to focus on a single task, rather than attempting to do many things at the same time. The classic toy example of this is to compute the sum of the squares of the numbe...
A Roadmap to Metacomputation by Supercompilation
, 1996
"... This paper gives a gentle introduction to Turchin's supercompilation and its applications in metacomputation with an emphasis on recent developments. First, a complete supercompiler, including positive driving and generalization, is defined for a functional language and illustrated with examples. Th ..."
Abstract

Cited by 33 (4 self)
 Add to MetaCart
This paper gives a gentle introduction to Turchin's supercompilation and its applications in metacomputation with an emphasis on recent developments. First, a complete supercompiler, including positive driving and generalization, is defined for a functional language and illustrated with examples. Then a taxonomy of related transformers is given and compared to the supercompiler. Finally, we put supercompilation into the larger perspective of metacomputation and consider three metacomputation tasks: specialization, composition, and inversion.
Proving the Correctness of RecursionBased Automatic Program Transformations
 Theoretical Computer Science
, 1996
"... This paper shows how the Improvement Theorema semantic condition ..."
Abstract

Cited by 31 (4 self)
 Add to MetaCart
This paper shows how the Improvement Theorema semantic condition
Improving Programs which Recurse over Multiple Inductive Structures
 In ACM SIGPLAN Workshop on Partial Evaluation and SemanticsBased Program Manipulation (PEPM'94
, 1994
"... This paper considers generic recursion schemes for programs which recurse over multiple inductive structures simultaneously, such as equality, zip and the nth element of a list function. Such schemes have been notably absent from previous work. This paper defines a uniform mechanism for defining suc ..."
Abstract

Cited by 25 (6 self)
 Add to MetaCart
This paper considers generic recursion schemes for programs which recurse over multiple inductive structures simultaneously, such as equality, zip and the nth element of a list function. Such schemes have been notably absent from previous work. This paper defines a uniform mechanism for defining such programs and shows that these programs satisfy generic theorems. These theorems are the basis for an automatic improvement algorithm. This algorithm is an improvement over the algorithm presented earlier [14] because, in addition to inducting over multiple structures, it can be incorporated into any algebraic language and is no longer restricted to a "safe" subset. 1 Introduction In previous work [14, 15, 6, 4, 5] we have shown how programming algebraically with generic recursion schemes provides a theory amenable to program calculation [13]. This theory provides a basis for automatic optimization techniques which capture many wellknown transformations. Unfortunately, these recursion sc...
Towards Unifying Partial Evaluation, Deforestation, Supercompilation, and GPC
, 1994
"... We study four transformation methodologies which are automatic instances of Burstall and Darlington's fold/unfold framework: partial evaluation, deforestation, supercompilation, and generalized partial computation (GPC). One can classify these and other fold/unfold based transformers by how much inf ..."
Abstract

Cited by 22 (0 self)
 Add to MetaCart
We study four transformation methodologies which are automatic instances of Burstall and Darlington's fold/unfold framework: partial evaluation, deforestation, supercompilation, and generalized partial computation (GPC). One can classify these and other fold/unfold based transformers by how much information they maintain during transformation. We introduce the positive supercompiler, a version of deforestation including more information propagation, to study such a classification in detail. Via the study of positive supercompilation we are able to show that partial evaluation and deforestation have simple information propagation, positive supercompilation has more information propagation, and supercompilation and GPC have even more information propagation. The amount of information propagation is significant: positive supercompilation, GPC, and supercompilation can specialize a general pattern matcher to a fixed pattern so as to obtain efficient output similar to that of the KnuthMorrisPratt algorithm. In the case of partial evaluation and deforestation, the general matcher must be rewritten to achieve this.
Comparison of Deforestation Techniques for Functional Programs and for Tree Transducers
 In FLOPS'99
, 1999
"... We compare transformations for the elimination of intermediate results in firstorder functional programs. We choose the well known deforestation technique of Wadler and composition techniques from the theory of tree transducers, of which the implementation of functional programs yet does not ta ..."
Abstract

Cited by 18 (5 self)
 Add to MetaCart
We compare transformations for the elimination of intermediate results in firstorder functional programs. We choose the well known deforestation technique of Wadler and composition techniques from the theory of tree transducers, of which the implementation of functional programs yet does not take advantage. We identify syntactic classes of function definitions for which both techniques deliver equally efficient results and for which one technique is more powerful than the other.
Deforestation for HigherOrder Functional Programs
, 1995
"... Functional programming languages are an ideal medium for program optimisations based on sourcetosource transformation techniques. Referential transparency affords opportunities for a wide range of correctnesspreserving transformations leading to potent optimisation strategies. This thesis builds ..."
Abstract

Cited by 17 (0 self)
 Add to MetaCart
Functional programming languages are an ideal medium for program optimisations based on sourcetosource transformation techniques. Referential transparency affords opportunities for a wide range of correctnesspreserving transformations leading to potent optimisation strategies. This thesis builds on deforestation, a program transformation technique due to Wadler that removes intermediate data structures from firstorder functional programs. Our contribution is to reformulate deforestation for higherorder functional programming languages, and to show that the resulting algorithm terminates given certain syntactic and typing constraints on the input. These constraints are entirely reasonable, indeed it is possible to translate any typed program into the required syntactic form. We show how this translation can be performed automatically and optimally. The higherorder deforestation algorithm is transparent. That is, it is possible to determine by examination of the source program w...