Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/141471.141494acmconferencesArticle/Chapter ViewAbstractPublication PageslfpConference Proceedingsconference-collections
Article
Free access

Safe fusion of functional expressions

Published: 01 January 1992 Publication History

Abstract

Large functional programs are often constructed by decomposing each big task into smaller tasks which can be performed by simpler functions. This hierarchical style of developing programs has been found to improve programmers' productivity because smaller functions are easier to construct and reuse. However, programs written in this way tend to be less efficient. Unnecessary intermediate data structures may be created. More function invocations may be required.
To reduce such performance penalties, Wadler proposed a transformation algorithm, called deforestation, which could automatically fuse certain composed expressions together in order to eliminate intermediate tree-like data structures. However, his technique is only applicable to a subset of first-order expressions.
This paper will generalise the deforestation technique to make it applicable to all first-order and higher-order functional programs. Our generalisation is made possible by the adoption of a model for safe fusion which views each function as a producer and its parameters as consumers. Through this model, static program properties are proposed to classify producers and consumers as either safe or unsafe. This classification is used to identify sub-terms that can be safely fused/eliminated. We present the generalised transformation algorithm as a set of syntax-directed rewrite rules, illustrate it with examples, and provide an outline of its termination proof.

References

[1]
Leonard Augustsson. Compiling pattern-matching. In Conference on Functional Programming and Computer Architecture (LNC$ ~01, ed Jouannaud), pages 368-381, Nancy, France, 1985.
[2]
RM Burstall and John Darlington. A transformation system for developing recursive programs. Journal of A ssoc,at~on for Computing Machinery, 24(1):44-67, January 1977.
[3]
D. Bjorner, AP. Ershov, and ND Jones. Workshop on Partial Evaluation and Mixed Computations. G1 Avarnes, Denmark, North-Holland, 1988.
[4]
Wei-Ngan Chin and John Darlington. Higher-order removal transformation technique for functional programs. In 15th Australian Computer Science Conference, Austrahan CS Comm Vol ld, No i, pages 181-194, Hobart, Tasmania, January 1992.
[5]
Wei-Ngan Chin. Automatic Methods for Program Transformation. PhD thesis, Imperial College, University of London, March 1990.
[6]
Wei-Ngan Chin. Generalising deforestation for all first-order functional programs, in Workshop on Static Analysis of Equational, Functional and Logic Programmzng Languages, BIGRE 7~, pages 173-181, Bordeaux,France, October 1991.
[7]
Charles Consel. Binding time analysis for higherorder untyped functional languages. 6th A CM Conference on Lisp and Functional Programming, pages 264-272, June 1990.
[8]
Martin S. Feather. A system for assisting program transformation. A CM Transaction on Programming Languages and Systems, 4(1):1-20, January 1982.
[9]
AB Ferguson and Phil Wadler. When will deforestation stop? In Proc of 1988 Glasgow Workshop on Functional Programming (as Research Report 89/R$ of Glasgow University), pages 39-56, Rothesay, Isle of Bute, August 1988.
[10]
Carsten Kehler Hoist. Finiteness analysis. In 5th A CM Conference on Functionalprogramming Languages and Computer Architecture, pages 473-495, Cambridge, Massachusetts, August 1991.
[11]
Neil J. Jones. Automatic program specialisalion: A re-examination from basic principles. In Workshop on Partial Evaluation and Mixed Computations, pages 225-282, GI Avarnes, Denmark, North-Holland, 1988.
[12]
ND Jones, P Sestoft, and H Sondergaard. An experiment in partial evaluation: the generation of a compiler generator. Journal of LISP and Symbolic Computation, 2(1):9-50, 1989.
[13]
V~lentln F. Turchin. The concept of ~ ~upercomprier. A CM Transaction on Programming Languages and Systems, 8(3):90-121, July 1986.
[14]
Phil Wadler. Listlessness is better than laziness: Lazy evaluation and garbage collection at compiletime. In A CM Symposium on Lisp and Functional Programming, pages 45-52, Austin, Texas, August 1984.
[15]
Phil Wadler. Listlessness is better than laziness II: Composing listless functions. In Workshop on Programs as Data Objects, pages 282-305, Springer- Verlag, New York, 1985.
[16]
Phil Wadler. Efficient compilation of patternmatching. In The Implementation of Functional Programming Languages (by Simon Peyton- Jones), chapter 5. Prentice-Hall International, 1987.
[17]
Phil Wadler. Deforestation: Transforming programs to eliminate trees. In European Symposium on Programming, pages 344-358, Nancy, France, March 1988.
[18]
Richard C. Waters. Automatic transformation of series expressions into loops. A CM Transaction on Programming Languages and Systems, 13(1):52- 98, January 1991.

Cited By

View all
  • (2024)Superfusion: Eliminating Intermediate Data Structures via Inductive SynthesisProceedings of the ACM on Programming Languages10.1145/36564158:PLDI(939-964)Online publication date: 20-Jun-2024
  • (2019)Transforming powerlist-based divide-and-conquer programs for an improved execution modelThe Journal of Supercomputing10.1007/s11227-019-02820-xOnline publication date: 25-Mar-2019
  • (2017)TreeFuser: a framework for analyzing and fusing general recursive tree traversalsProceedings of the ACM on Programming Languages10.1145/31339001:OOPSLA(1-30)Online publication date: 12-Oct-2017
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
LFP '92: Proceedings of the 1992 ACM conference on LISP and functional programming
January 1992
365 pages
ISBN:0897914813
DOI:10.1145/141471
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 January 1992

Permissions

Request permissions for this article.

Check for updates

Qualifiers

  • Article

Conference

LFP92
LFP92: ACM Conference on Lisp and Functional Programming
June 22 - 24, 1992
California, San Francisco, USA

Acceptance Rates

Overall Acceptance Rate 30 of 109 submissions, 28%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)85
  • Downloads (Last 6 weeks)19
Reflects downloads up to 15 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Superfusion: Eliminating Intermediate Data Structures via Inductive SynthesisProceedings of the ACM on Programming Languages10.1145/36564158:PLDI(939-964)Online publication date: 20-Jun-2024
  • (2019)Transforming powerlist-based divide-and-conquer programs for an improved execution modelThe Journal of Supercomputing10.1007/s11227-019-02820-xOnline publication date: 25-Mar-2019
  • (2017)TreeFuser: a framework for analyzing and fusing general recursive tree traversalsProceedings of the ACM on Programming Languages10.1145/31339001:OOPSLA(1-30)Online publication date: 12-Oct-2017
  • (2017)Momentum-Mapped Inverted Pendulum Models for Controlling Dynamic Human MotionsACM Transactions on Graphics10.1145/3072959.298361636:4(1)Online publication date: 16-Jul-2017
  • (2016)Flowchart Programs, Regular Expressions, and Decidability of Polynomial Growth-RateElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.216.2216(24-49)Online publication date: 6-Jul-2016
  • (2011)MementosACM SIGPLAN Notices10.1145/1961296.195038646:3(159-170)Online publication date: 5-Mar-2011
  • (2011)NV-HeapsACM SIGPLAN Notices10.1145/1961296.195038046:3(105-118)Online publication date: 5-Mar-2011
  • (2011)Theory and Practice of FusionImplementation and Application of Functional Languages10.1007/978-3-642-24276-2_2(19-37)Online publication date: 2011
  • (2010)Theory and practice of fusionProceedings of the 22nd international conference on Implementation and application of functional languages10.5555/2050135.2050137(19-37)Online publication date: 1-Sep-2010
  • (2010)Context-preserving XQuery fusionProceedings of the 8th Asian conference on Programming languages and systems10.5555/1947873.1947897(255-270)Online publication date: 28-Nov-2010
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media