Abstract
Deforestation is a well-known program transformation technique which eliminates intermediate data structures that are passed between functions. One of its weaknesses is the inability to deforest programs using accumulating parameters.
We show how intermediate lists built by a selected class of functional programs, namely ‘accumulating maps’, can be deforested using a single composition rule. For this we introduce a new function dmap, a symmetric extension of the familiar function map. While the associated composition rule cannot capture all deforestation problems, it can handle accumulator fusion of functions defined in terms of dmap in a surprisingly simple way. The rule for accumulator fusion presented here can also be viewed as a restricted composition scheme for attribute grammars, which in turn may help us to bridge the gap between the attribute and functional world.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
R. Burstall and J. Darlington. A transformation system for developing recursive programs. J. ACM, 24(1): 44–67, 1977.
W.-N. Chin. Safe fusion of functional expressions II: Further improvements. J. Funct. Prog., 4(4): 515–555, 1994.
O. Chitil. Type inference builds a short cut to deforestation. Proc. of the International Conference on Functional Programming, 249–260, ACM Press 1999.
L. Correnson, E. Duris, D. Parigot, and G. Roussel. Declarative program transformation: A deforestation case-study. In G. Nadathur (ed.), Principles and Practice of Declarative Programming, LNCS 1702, 360–377, Springer-Verlag 1999.
Z. Fülöp. On attributed tree transducers. Acta Cybern., 5: 261–279, 1981.
Z. Fülöp and H. Vogler. Syntax-directed semantics: Formal models based on tree transducers. EATCS Monographs Theoret. Comp. Sci., Springer-Verlag 1998.
H. Ganzinger. Increasing modularity and language-independency in automatically generated compilers. Sci. Comput. Prog., 3: 223–278, 1983.
R. Giegerich. Composition and evaluation of attribute coupled grammars. Acta Inf., 25(4): 355–423, 1988.
A. Gill, J. Launchbury, and S. Jones. A short cut to deforestation. In Proc. Conference on Functional Programming Languages and Computer Architecture, 223–232, ACM Press 1993.
Z. Hu, H. Iwasaki, and M. Takeichi. Calculating accumulations. New Gener. Comput., 17(2): 153–173, 1999.
T. Johnsson. Attribute grammars as a functional programming paradigm. In G. Kahn (ed.), Functional Programming Languages and Computer Architecture, LNCS 274, 154–173, Springer-Verlag 1987.
K. Kakehi, R. Glück, and Y. Futamura. An Extension of Shortcut Deforestation for Accumulative List Folding. IEICE Trans. on Inf. & Syst., to appear.
A. Kühnemann. Berechnungsstärken von Teilklassen primitiv-rekursiver Programmschemata. Ph.D thesis, Technical University of Dresden, 1997. In German.
A. Kühnemann. Benefits of tree transducers for optimizing functional programs. In V. Arvind and R. Pamanujan (eds.), Foundations of Software Technology and Theoretical Computer Science, LNCS 1530, 146–157, Springer-Verlag 1998.
A. Kühnemann. Comparison of deforestation techniques for functional programs and for tree transducers. In A. Middeldorp and T. Sato (eds.), Functional and Logic Programming, LNCS 1722, 114–130, Springer-Verlag 1999.
A. Kühnemann, R. Glück, and K. Kakehi. Relating accumulative and non-accumulative functional programs. In A. Middeldorp (ed.), Rewriting Techniques and Applications, LNCS 2051, 154–168, Springer-Verlag 2001.
J. Launchbury and T. Sheard. Warm fusion: Deriving build-catas from recursive definitions. In Proc. International Conference on Functional Programming Languages and Computer Architecture, 314–323, ACM Press 1995.
A. Pettorossi. Program development using lambda abstraction. In K. Nori (ed.), Foundations of Software Technology and Theoretical Computer Science, LNCS 287, 420–434, Springer-Verlag 1987.
A. Pettorossi and A. Skowron. The lambda abstraction strategy for program derivation. Fund. Inform., 12(4): 541–561, 1989.
D. Sands. Total correctness by local improvement in the transformation of functional programs. ACM TOPLAS, 18(2): 175–234, 1996.
M. H. Sørensen, R. Glück, and N. D. Jones. A positive supercompiler. J. Funct. Prog., 6(6): 811–838, 1996.
V. Turchin. The concept of a supercompiler. ACM TOPLAS, 8(3): 292–325, 1986.
P. Wadler. The concatenate vanishes. Internal report, Dept. of Comp. Sci., Univ. of Glasgow, 1987.
P. Wadler. Deforestation: transforming programs to eliminate trees. Theoret. Comput. Sci., 73(2): 231–248, 1990.
M. Wand. Continuation-based program transformation strategies. J. ACM, 27(1): 164–180, 1980.
D. Whitfield and M. Soffa. An approach for exploring code-improving transformations. ACM TOPLAS, 19(6): 1053–1084, 1997.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Kakehi, K., Glück, R., Futamura, Y. (2002). On Deforesting Parameters of Accumulating Maps. In: Pettorossi, A. (eds) Logic Based Program Synthesis and Transformation. LOPSTR 2001. Lecture Notes in Computer Science, vol 2372. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45607-4_3
Download citation
DOI: https://doi.org/10.1007/3-540-45607-4_3
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-43915-8
Online ISBN: 978-3-540-45607-0
eBook Packages: Springer Book Archive