Skip to main content
    • Aa
    • Aa

Manipulating accumulative functions by swapping call-time and return-time computations*


Functional languages are suitable for transformational developments of programs. However, accumulative functions, or in particular tail-recursive functions, are known to be less suitable for manipulation. In this paper, we propose a program transformation named “IO swapping” that swaps call-time and return-time computations. It moves computations in accumulative parameters to results and thereby enables interesting transformations. We demonstrate effectiveness of IO swapping by several applications: deforestation, higher order removal, program inversion, and manipulation of circular programs.

Linked references
Hide All

This list contains references from the content that can be linked to their source. For a full set of references and notes please see the PDF or HTML where available.

R. S. Bird (1984) Using circular programs to eliminate multiple traversals of data. Acta Inf. 21, 239250.

E. A. Boiten (1992) Improving recursive functions by inverting the order of evaluation. Sci. Comput. Program. 18 (2), 139179.

R. S. Boyer & J. S. Moore (1975) Proving theorems about Lisp functions. J. ACM. 22 (1), 129144.

R. S. Boyer , J. S. Moore & R. E. Shostak (1976) Primitive recursive program transformations. In Proceedings of POPL'76: Conference Record of the Third ACM Symposium on Principles of Programming Languages, Atlanta, Georgia. Pittsburgh, PA: ACM Press, pp. 171174.

R. M. Burstall & J. Darlington (1977) A transformation system for developing recursive programs. J. ACM. 24 (1), 4467.

L. Correnson , É. Duris , D. Parigot & G. Roussel (1999) Declarative program transformation: A deforestation case-study. In Proceedings of International Conference on Principles and Practice of Declarative Programming (PPDP'99), Paris, France. Lecture Notes in Computer Science, vol. 1702. Berlin, Germany: Springer-Verlag, pp. 360377.

J. P. Fernandes & J. Saraiva (2007) Tools and libraries to model and manipulate circular programs. In Proceedings of the 2007 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation, Nice, France. Pittsburgh, PA: ACM, pp. 102111.

J. Giesl , A. Kühnemann & J. Voigtländer (2007) Deaccumulation techniques for improving provability. J. Log. Algebr. Program. 71 (2), 79113.

A. Gill , J. Launchbury & Jones S. Peyton (1993) A short cut to deforestation. In Proceedings of FPCA'93 Conference on Functional Programming Languages and Computer Architecture, Copenhagen, Denmark. New York, NY: ACM Press, pp. 223232.

A. Kühnemann (1998) Benefits of tree transducers for optimizing functional programs. In Proceedings of the 18th Conference on Foundations of Software Technology and Theoretical Computer Science, Chennai, India. Lecture Notes in Computer Science, vol. 1530. Berlin, Germany: Springer-Verlag, pp. 146157.

A. Kühnemann (1999) Comparison of deforestation techniques for functional programs and for tree transducers. In Proceedings of the 4th Fuji International Symposium on Functional and Logic Programming (FLOPS'99), Tukuba, Japan. Lecture Notes in Computer Science, vol. 1722. Berlin, Germany: Springer-Verlag, pp. 114130.

E. Meijer , M. M. Fokkinga & R. Paterson (1991) Functional programming with bananas, lenses, envelopes and barbed wire. In Proceedings of the 5th ACM Conference on Functional Programming Languages and Computer Architecture, Cambridge, MA, USA. Lecture Notes in Computer Science, vol. 523. Berlin, Germany: Springer-Verlag, pp. 124144.

A. Morihata , K. Kakehi , Z. Hu & M. Takeichi (2006) Swapping arguments and results of recursive functions. In Proceedings of the 8th International Conference on Mathematics of Program Construction (MPC 2006), Kuressaare, Estonia. Lecture Notes in Computer Science, vol. 4014. Berlin, Germany: Springer-Verlag, pp. 379396.

J. Svenningsson (2002) Shortcut fusion for accumulating parameters & zip-like functions. In Proceedings of the 7th ACM SIGPLAN International Conference on Functional Programming (ICFP'02), Pittsburgh, Pennsylvania, USA. New York, NY: ACM Press, pp. 124132.

A. Takano & E. Meijer (1995) Shortcut deforestation in calculational form. In Proceedings of SIGPLAN-SIGARCH-WG2.8 Conference on Functional Programming Languages and Computer Architecture (conference record of FPCA'95), La Jolla, CA, USA. New York, NY: ACM Press, pp. 306313.

J. Voigtländer (2004) Using circular programs to deforest in accumulating parameters. Higher-Order Symb. Comput. 17 (1–2), 129163.

P. Wadler (1990) Deforestation: Transforming programs to eliminate trees. Theor. Comput. Sci. 73 (2), 231248.

M. Wand (1980) Continuation-based program transformation strategies. J. ACM. 27 (1), 164180.

Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *


Full text views

Total number of HTML views: 0
Total number of PDF views: 11 *
Loading metrics...

Abstract views

Total abstract views: 73 *
Loading metrics...

* Views captured on Cambridge Core between September 2016 - 20th September 2017. This data will be updated every 24 hours.