Detecting sharing of partial applications in functional programs

  • Benjamin Goldberg
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 274)


A method is presented for detecting sharing of partial function applications in higher order functional programs. Such sharing occurs when there are several references to variables that are bound to a particular function application. In order to provide an interprocedural analysis, a non-standard semantics is defined for a lazy, higher-order functional language such that the meaning of a program is information about the sharing that occurred during its execution. An abstraction of this non-standard semantics is presented so that useful, although less complete, sharing information can be provided at compile-time.

In the second part of this paper, we utilize sharing detection in order to provide an efficient method for ensuring full laziness during program execution. A refinement of the method used to generate Hughes' super-combinators is discussed. Super-combinators insure that no unnecessary computation is performed when sharing occurs in a program. Unfortunately, the algorithm used to generate super-combinators assumes that every function application is shared and some unnecessary overhead is incurred while executing super-combinators. The refined super-combinators, called super-duper combinators, presented in this paper incur no unnecessary overhead in the cases where no sharing occurs.


Formal Parameter Abstract Interpretation Functional Language Standard Semantic Free Expression 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. [1]
    Adrienne Bloss and Paul Hudak. Variations on strictness analysis. In Proc. 1986 ACM Conference on Lisp and Functional Programming, pages 132–142, ACM SIGPLAN/SIGACT/SIGART, Cambridge, Massachusetts, August 1986.Google Scholar
  2. [2]
    G.L. Burn, C.L. Hankin, and S. Abramsky. The theory of strictness analysis for higher order functions. In LNCS 217: Programs as Data Objects, pages 42–62, Springer-Verlag, 1985.Google Scholar
  3. [3]
    C. Clack and S.L. Peyton Jones. Strictness analysis — a practical approach. In Functional Programming Languages and Computer Architecture, pages 35–49, Springer-Verlag LNCS 201, September 1985.Google Scholar
  4. [4]
    P. Cousot and R. Cousot. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In 4th ACM Sym. on Prin. of Prog. Lang., pages 238–252, ACM, 1977.Google Scholar
  5. [5]
    H.K. Curry and R. Feys. Combinatory Logic. Noth-Holland Pub. Co., Amsterdam, 1958.Google Scholar
  6. [6]
    P. Hudak and J. Young. Higher-order strictness analysis for untyped lambda calculus. In 12th ACM Sym. on Prin. of Prog. Lang., pages 97–109, January 1986.Google Scholar
  7. [7]
    R.J.M. Hughes. Super-combinators: a new implementation method for applicative languages. In Proc. 1982 ACM Conf. on LISP and Functional Prog., pages 1–10, ACM, August 1982.Google Scholar
  8. [8]
    T. Johnsson. The G-machine: an abstract machine for graph reduction. Technical Report, PMG, Dept. of Computer Science, Chalmers Univ. of Tech., February 1985.Google Scholar
  9. [9]
    A. Mycroft. Abstract Interpretation and Optimizing Transformations for Applicative Programs. PhD thesis, Univ. of Edinburgh, 1981.Google Scholar
  10. [10]
    M. Schonfinkel. Uber die bausteine der mathematischen logik. Mathematische Annalen, 92:305, 1924.Google Scholar
  11. [11]
    J.E. Stoy. Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory. The MIT Press, Cambridge, Mass., 1977.Google Scholar
  12. [12]
    D.A. Turner. A new implementation technique for applicative languages. Software — Practice and Experience, 9:31–49, 1979.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1987

Authors and Affiliations

  • Benjamin Goldberg
    • 1
  1. 1.Department of Computer ScienceYale UniversityNew Haven

Personalised recommendations