Skip to main content

Towards a Modular Program Derivation via Fusion and Tupling

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2487))

Abstract

We show how programming pearls can be systematically derived via fusion, followed by tupling transformations. By focusing on the elimination of intermediate data structures (fusion) followed by the elimination of redundant calls (tupling), we systematically realise both space and time efficient algorithms from naive specifications. We illustrate our approach using a well-known maximum segment sum (MSS) problem, and a less-known maximum segment product (MSP) problem. While the two problems share similar specifications, their optimised codes are significantly different. This divergence in the transformed codes do not pose any difficulty. By relying on modular techniques, we are able to systematically reuse both code and transformation in our derivation.

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

Buying options

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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

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

    Google Scholar 

  2. Jon Bentley. Programming Pearls. Addison-Wesley, 1986.

    Google Scholar 

  3. Richard S. Bird. The promotion and accumulation strategies in transformational programming. ACM Trans. on Programming Languages and Systems, 6(4):487–504, October 1984.

    Google Scholar 

  4. Richard S. Bird. Lectures on Constructive Functional Programming. Springer-Verlag, 1988.

    Google Scholar 

  5. Richard S. Bird. Lecture notes on theory of lists. In STOP Summer School on Constructive Algorithmics, Abeland, pages 1–25, 9 1989.

    MathSciNet  Google Scholar 

  6. Wei-Ngan Chin. Safe fusion of functional expressions. In 7th ACM LISP and Functional Programming Conference, pages 11–20, San Francisco, California, June 1992. ACM Press.

    Google Scholar 

  7. Wei-Ngan Chin. Towards an automated tupling strategy. In ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pages 119–132, Copenhagen, Denmark, June 1993. ACM Press.

    Google Scholar 

  8. Wei-Ngan Chin. Safe fusion of functional expressions II: Further improvements. Journal of Functional Programming, 4(4):515–555, October 1994.

    Google Scholar 

  9. Manuel MT Chakravarty and Gabriele Keller. Functional array fusion. In ACM Intl. Conference on Functional Programming, pages 205–216, Florence, Italy, September 2001. ACM Press.

    Google Scholar 

  10. W.N. Chin and A. Takano. Deriving laws by program specialization. Technical report, Hitachi Advanced Research Laboratory, July 1997.

    Google Scholar 

  11. M. Fokkinga. Tupling and mutumorphisms. Squiggolist, 1(4), 1989.

    Google Scholar 

  12. M. Fokkinga. Law and Order in Algorithmics. Ph.D thesis, Dept. INF, University of Twente, The Netherlands, 1992.

    Google Scholar 

  13. A. Gill, J. Launchbury, and S. Peyton-Jones. A short-cut to deforestation. In 6th ACM Conference on Functional Programming Languages and Computer Architecture, Copenhagen, Denmark, June 1993. ACM Press.

    Google Scholar 

  14. Z. Hu, H. Iwasaki, and M. Takeichi. Deriving structural hylomorphisms from recursive definitions. In ACM SIGPLAN International Conference on Functional Programming, pages 73–82, Philadelphia, Pennsylvannia, May 1996. ACM Press.

    Google Scholar 

  15. Z. Hu, H. Iwasaki, and M. Takeichi. Calculating accumulations. New Generation Computing, 17(2):153–173, 1999.

    Article  Google Scholar 

  16. Z. Hu, H. Iwasaki, M. Takeichi, and A. Takano. Tupling calculation eliminates multiple traversals. In 2nd ACM SIGPLAN International Conference on Functional Programming, pages 164–175, Amsterdam, Netherlands, June 1997. ACM Press.

    Google Scholar 

  17. Z. Hu, M. Takeichi, and W.N. Chin. Parallelization in calculational forms. In 25th Annual ACM Symposium on Principles of Programming Languages, pages 316–328, San Diego, California, January 1998. ACM Press.

    Google Scholar 

  18. J. Jeuring. Theories for Algorithm Calculation. Ph.D thesis, Faculty of Science, Utrecht University, 1993.

    Google Scholar 

  19. S. Peyton Jones and J. Hughes, editors. Haskell 98: A Non-strict, Purely Functional Language. Available online: http://www.haskell.org, February 1999.

  20. T. Sheard and L. Fegaras. A fold for all seasons. In 6th ACM Conference on Functional programming Languages and Computer Architecture, Copenhagen, Denmark, June 1993. ACM Press.

    Google Scholar 

  21. M.H. Sørensen, R. Glück, and Jones N.D. Towards unifying deforestation, supercompilation, partial evaluation and generalised partial computation. In European Symposium on Programming (LNCS 788), Edinburgh, April 1994.

    Google Scholar 

  22. Douglas R. Smith. KIDS-a semi-automatic program development system. Technical report, Kestrel Institute, October 1989.

    Google Scholar 

  23. H. Seidl and M.H. Sørensen. Constraints to stop higher-order deforestation. In 24th ACM Symposium on Principles of Programming Languages, Paris, France, January 1997. ACM Press.

    Google Scholar 

  24. M. Takeichi and Z. Hu. Calculation carrying programs: How to code program transformations (invited paper). In International Sumposium on Principles of Software Evolution (ISPSE 2000), Kanazawa, Japan, November 2000. IEEE Press.

    Google Scholar 

  25. A. Takano and E. Meijer. Shortcut deforestation in calculational form. In ACM Conference on Functional Programming and Computer Architecture, pages 306–313, San Diego, California, June 1995. ACM Press.

    Google Scholar 

  26. Phil Wadler. Deforestation: Transforming programs to eliminate trees. In European Symposium on Programming, Nancy, France, (LNCS, vol 300, pp. 344–358), March 1988.

    Google Scholar 

  27. T. Yokoyama, Z. Hu, and M. Takeichi. Yicho: A system for programming program calculations. Technical Report METR 2002-07, Department of Mathematical Engineering, University of Tokyo, June 2002. submitted for publication.

    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

Chin, WN., Hu, Z. (2002). Towards a Modular Program Derivation via Fusion and Tupling. In: Batory, D., Consel, C., Taha, W. (eds) Generative Programming and Component Engineering. GPCE 2002. Lecture Notes in Computer Science, vol 2487. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45821-2_9

Download citation

  • DOI: https://doi.org/10.1007/3-540-45821-2_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-44284-4

  • Online ISBN: 978-3-540-45821-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics