Results 1 - 10
of
29
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 lists---and, more generally, interm ..."
Abstract
-
Cited by 375 (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 lists---and, more generally, intermediate trees---are 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 style---they 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 sums-of-products with tuples and functio ..."
Abstract
-
Cited by 107 (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 sums-of-products 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 ...
Warm Fusion: Deriving Build-Catas 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 multi-pass 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 70 (2 self)
- Add to MetaCart
Program fusion is the process whereby separate pieces of code are fused into a single piece, typically transforming a multi-pass 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 constructor-abstraction (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 multi-pass algorithms, in which intermediate data-structures 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...
Synchronous Kahn Networks
, 1996
"... Synchronous data-flow is a programming paradigm which has been successfully applied in reactive systems. In this context, it can be characterized as some class of static bounded memory data-flow networks. In particular, these networks are not recursively defined, and obey some kind of "synchronous" ..."
Abstract
-
Cited by 49 (7 self)
- Add to MetaCart
Synchronous data-flow is a programming paradigm which has been successfully applied in reactive systems. In this context, it can be characterized as some class of static bounded memory data-flow networks. In particular, these networks are not recursively defined, and obey some kind of "synchronous" constraints (clock calculus). Based on Kahn's relationship between data-flow and stream functions, the synchronous constraints can be related to Wadler's listlessness, and can be seen as sufficient conditions ensuring listless evaluation. As a by-product, those networks enjoy efficient compiling techniques. In this paper, we show that it is possible to extend the class of static synchronous data-flow to higher order and dynamical networks, thus giving sense to a larger class of synchronous data-flow networks.
Compiling Scientific Code using Partial Evaluation
- IEEE Computer
, 1989
"... Scientists are faced with a dilemma: Either they can write abstract programs that express their understanding of a problem, but which do not execute efficiently; or they can write programs that computers can execute efficiently, but which are difficult to write and difficult to understand. We hav ..."
Abstract
-
Cited by 47 (4 self)
- Add to MetaCart
Scientists are faced with a dilemma: Either they can write abstract programs that express their understanding of a problem, but which do not execute efficiently; or they can write programs that computers can execute efficiently, but which are difficult to write and difficult to understand. We have developed a compiler that uses partial evaluation and scheduling techniques to provide a solution to this dilemma.
Shortcut Fusion for Accumulating Parameters Zip-like Functions
, 2002
"... We present an alternative approach to shortcut fusion based on the function unfoldr. Despite its simplicity the technique can remove intermediate lists in examples which are known to be difficult. We show that it can remove all lists from definitions involving zip-like functions and functions using ..."
Abstract
-
Cited by 38 (0 self)
- Add to MetaCart
We present an alternative approach to shortcut fusion based on the function unfoldr. Despite its simplicity the technique can remove intermediate lists in examples which are known to be difficult. We show that it can remove all lists from definitions involving zip-like functions and functions using accumulating parameters.
Filter Fusion
- In Symposium on Principles of Programming Languages
, 1996
"... Introduction Filters are a common data-manipulation abstraction in networking, operating systems, and simulation software. Filters read data from a single source and write data to a single destination. In filter applications, data flows from a source to a sink through intermediate filters. Logicall ..."
Abstract
-
Cited by 35 (1 self)
- Add to MetaCart
Introduction Filters are a common data-manipulation abstraction in networking, operating systems, and simulation software. Filters read data from a single source and write data to a single destination. In filter applications, data flows from a source to a sink through intermediate filters. Logically, filters are separate, modular entities. Modular implementations unfortunately suffer a substantial performance penalty relative to integrated implementations. Where performance matters most, systems programmers will sacrifice the modular design for the greater speed of an integrated design. We present a new compiler optimization, Filter Fusion, that eliminates the overhead of a modular design of independent filters. Our algorithm automates the integration of arbitrary, independently designed filters. FFC, our Filter Fusion compiler, composes filters and produces code that is as efficient as handintegrated code. The optimized code can achieve up to a two-fold improvement
Practical Implementation of a Dependently Typed Functional Programming Language
, 2005
"... Language ..."
Improving Programs which Recurse over Multiple Inductive Structures
- In ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based 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 well-known transformations. Unfortunately, these recursion sc...

