Skip to main content
Log in

The essence of eta-expansion in partial evaluation

  • Published:
LISP and Symbolic Computation

Abstract

Selective eta-expansion is a powerful “binding-time improvement”,i.e., a source-program modification that makes a partial evaluator yield better results. But like most binding-time improvements, the exact problem it solves and the reason why have not been formalized and are only understood by few.

In this paper, we describe the problem and the effect of eta-redexes in terms of monovariant binding-time propagation: eta-redexes preserve the static data flow of a source program by interfacingstatic higher-order values in dynamic contexts anddynamic higher-order values in static contexts. They contribute to twodistinct binding-time improvements.

We present two extensions of Gomard's monovariant binding-time analysis for the pure λ-calculus. Our extensions annotateand eta-expand λ-terms. The first one eta-expands static higher-order values in dynamic contexts. The second also eta-expands dynamic higher-order values in static contexts.

As a significant application, we show that our first binding-time analysis suffices to reformulate the traditional formulation of a CPS transformation into a modern one-pass CPS transformer. This binding-time improvement is known, but it is still left unexplained in contemporary literature,e.g., about “cps-based” partial evaluation.

We also outline the counterpart of eta-expansion for partially static data structures.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Henk Barendregt.The Lambda Calculus — Its Syntax and Semantics. North-Holland, 1984.

  2. Anders Bondorf. Automatic autoprojection of higher-order recursive equations.Science of Computer Programming, 17(1–3):3–34, 1991.

    Google Scholar 

  3. Anders Bondorf. Improving binding times without explicit CPS-conversion. In William Clinger, editor,Proceedings of the 1992 ACM Conference on Lisp and Functional Programming, San Francisco, California, June 1992, LISP Pointers V(1):1–10. ACM Press.

  4. Anders Bondorf and Olivier Danvy. Automatic autoprojection of recursive equations with global variables and abstract data types.Science of Computer Programming, 16:151–195, 1991.

    Google Scholar 

  5. Anders Bondorf and Dirk Dussart. Improving CPS-based partial evaluation: Writing cogen by hand. In Peter Sestoft and Harald Søndergaard, editors,ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation, Orlando, Florida, June 1994, Technical Report 94/9, University of Melbourne, Australia, pages 1–10.

  6. Anders Bondorf and Jens Palsberg. Compiling actions by partial evaluation. In Arvind, editor,Proceedings of the Sixth ACM Conference on Functional Programming and Computer Architecture, Copenhagen, Denmark, June 1993, pages 308–317. ACM Press.

  7. Charles Consel. Polyvariant binding-time analysis for applicative languages. In Schmidt [25], pages 66–77.

  8. Charles Consel. A tour of Schism: A partial evaluation system for higher-order applicative languages. In Schmidt [25], pages 145–154.

  9. Charles Consel and Olivier Danvy. For a better support of static data flow. In Hughes [13], pages 496–519.

  10. Charles Consel and Olivier Danvy. Tutorial notes on partial evaluation. InProceedings of the Twentieth Annual ACM Symposium on Principles of Programming Languages, Charleston, South Carolina, January 1993, pages 493–501. ACM Press.

  11. Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation.Mathematical Structures in Computer Science, 2(4):361–391, December 1992.

    Google Scholar 

  12. Carsten K. Gomard.Program Analysis Matters. PhD thesis, DIKU, Computer Science Department, University of Copenhagen, Copenhagen, Denmark, November 1990, DIKU Report 91-17.

  13. John Hughes, editor.Proceedings of the Fifth ACM Conference on Functional Programming and Computer Architecture, Cambridge, Massachusetts, August 1991, LNCS 523. Springer-Verlag, 1991.

  14. Neil D. Jones. Automatic program specialization: A re-examination from basic principles. In Dines Bjørner, Andrei P. Ershov, and Neil D. Jones, editors,Partial Evaluation and Mixed Computation, pages 225–282. North-Holland, 1988.

  15. Neil D. Jones, Carsten K. Gomard, and Peter Sestoft.Partial Evaluation and Automatic Program Generation. Prentice Hall International, 1993.

  16. Julia L. Lawall.Continuation Introduction and Elimination in Higher-Order Programming Languages. PhD thesis, Computer Science Department, Indiana University, Bloomington, Indian, USA, July 1994.

    Google Scholar 

  17. Julia L. Lawall and Olivier Danvy. Continuation-based partial evaluation. In Carolyn L. Talcott, editor,Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, Orlando, Florida, June1994, LISP Pointers VII(3):227–238. ACM Press.

    Google Scholar 

  18. Torben Æ. Mogensen.Binding Time Aspects of Partial Evaluation. PhD thesis, DIKU, Computer Science Department, University of Copenhagen, Copenhagen, Denmark, March 1989.

    Google Scholar 

  19. Torben Æ. Mogensen. Constructor specialization. In Schmidt [25], pages 22–32.

  20. Christian Mossin. Partial evaluation of general parsers. In Schmidt [25], pages 13–21.

  21. Flemming Nielson and Hanne Riis Nielson.Two-Level Functional Languages, volume 34 ofCambridge Tracts in Theoretical Computer Science. Cambridge University Press, 1992.

  22. Jens Palsberg. Correctness of binding-time analysis.Journal of Functional Programming, 3(3):347–363, 1993.

    Google Scholar 

  23. Gordon D. Plotkin. Call-by-name, call-by-value and the λ-calculus.Theoretical Computer Science, 1:125–159, 1975.

    Google Scholar 

  24. Erik Ruf.Topics in Online Partial Evaluation. PhD thesis, Stanford University, Stanford, California, February 1993. Technical report CSL-TR-93-563.

  25. David A. Schmidt, editor.Proceedings of the Second ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, Copenhagen, Denmark, June 1993. ACM Press.

    Google Scholar 

  26. Guy L. Steele Jr. Rabbit: A Compiler for Scheme. Technical Report AI-TR-474, Artificial Intelligence Laboratory, Massachusetts Institute of Technology, Cambridge, Massachusetts, May 1978.

    Google Scholar 

  27. Mitchell Wand. Correctness of procedure representations in higher-order assembly language. In Stephen Brookeset al., editors,Mathematical Foundations of Programming Semantics, Pittsburgh, Pennsylvania, March 1991, LNCS 598, pages 294–311. Springer-Verlag, 1991.

  28. Daniel Weise, Roland Conybeare, Erik Ruf, and Scott Seligman. Automatic online partial evaluation. In Hughes [13], pages 165–191.

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Danvy, O., Malmkjær, K. & Palsberg, J. The essence of eta-expansion in partial evaluation. Lisp and Symbolic Computation 8, 209–227 (1995). https://doi.org/10.1007/BF01019004

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01019004

Keywords

Navigation