Skip to main content

On Deforesting Parameters of Accumulating Maps

  • Conference paper
  • First Online:
Logic Based Program Synthesis and Transformation (LOPSTR 2001)

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. R. Burstall and J. Darlington. A transformation system for developing recursive programs. J. ACM, 24(1): 44–67, 1977.

    Article  MATH  MathSciNet  Google Scholar 

  2. W.-N. Chin. Safe fusion of functional expressions II: Further improvements. J. Funct. Prog., 4(4): 515–555, 1994.

    Google Scholar 

  3. O. Chitil. Type inference builds a short cut to deforestation. Proc. of the International Conference on Functional Programming, 249–260, ACM Press 1999.

    Google Scholar 

  4. 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.

    Chapter  Google Scholar 

  5. Z. Fülöp. On attributed tree transducers. Acta Cybern., 5: 261–279, 1981.

    MATH  Google Scholar 

  6. Z. Fülöp and H. Vogler. Syntax-directed semantics: Formal models based on tree transducers. EATCS Monographs Theoret. Comp. Sci., Springer-Verlag 1998.

    Google Scholar 

  7. H. Ganzinger. Increasing modularity and language-independency in automatically generated compilers. Sci. Comput. Prog., 3: 223–278, 1983.

    Article  MATH  MathSciNet  Google Scholar 

  8. R. Giegerich. Composition and evaluation of attribute coupled grammars. Acta Inf., 25(4): 355–423, 1988.

    Article  MathSciNet  Google Scholar 

  9. 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.

    Google Scholar 

  10. Z. Hu, H. Iwasaki, and M. Takeichi. Calculating accumulations. New Gener. Comput., 17(2): 153–173, 1999.

    Article  Google Scholar 

  11. 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.

    Google Scholar 

  12. K. Kakehi, R. Glück, and Y. Futamura. An Extension of Shortcut Deforestation for Accumulative List Folding. IEICE Trans. on Inf. & Syst., to appear.

    Google Scholar 

  13. A. Kühnemann. Berechnungsstärken von Teilklassen primitiv-rekursiver Programmschemata. Ph.D thesis, Technical University of Dresden, 1997. In German.

    Google Scholar 

  14. 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.

    Google Scholar 

  15. 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.

    Chapter  Google Scholar 

  16. 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.

    Chapter  Google Scholar 

  17. 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.

    Google Scholar 

  18. 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.

    Google Scholar 

  19. A. Pettorossi and A. Skowron. The lambda abstraction strategy for program derivation. Fund. Inform., 12(4): 541–561, 1989.

    MATH  MathSciNet  Google Scholar 

  20. D. Sands. Total correctness by local improvement in the transformation of functional programs. ACM TOPLAS, 18(2): 175–234, 1996.

    Article  Google Scholar 

  21. M. H. Sørensen, R. Glück, and N. D. Jones. A positive supercompiler. J. Funct. Prog., 6(6): 811–838, 1996.

    MATH  Google Scholar 

  22. V. Turchin. The concept of a supercompiler. ACM TOPLAS, 8(3): 292–325, 1986.

    Article  MATH  MathSciNet  Google Scholar 

  23. P. Wadler. The concatenate vanishes. Internal report, Dept. of Comp. Sci., Univ. of Glasgow, 1987.

    Google Scholar 

  24. P. Wadler. Deforestation: transforming programs to eliminate trees. Theoret. Comput. Sci., 73(2): 231–248, 1990.

    Article  MATH  MathSciNet  Google Scholar 

  25. M. Wand. Continuation-based program transformation strategies. J. ACM, 27(1): 164–180, 1980.

    Article  MATH  MathSciNet  Google Scholar 

  26. D. Whitfield and M. Soffa. An approach for exploring code-improving transformations. ACM TOPLAS, 19(6): 1053–1084, 1997.

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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

Publish with us

Policies and ethics