Programming in the λ-Calculus: From Church to Scott and Back

  • Jan Martin Jansen
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8106)


Although the λ-calculus is well known as a universal programming language, it is seldom used for actual programming or expressing algorithms. Here we demonstrate that it is possible to use the λ-calculus as a comprehensive formalism for programming by showing how to convert programs written in functional programming languages like Clean and Haskell to closed λ-expressions. The transformation is based on using the Scott-encoding for Algebraic Data Types instead of the more common Church encoding. In this way we not only obtain an encoding that is better comprehensible but that is also more efficient. As a proof of the pudding we provide an implementation of Eratosthenes’ prime sieve algorithm as a self-contained, 143 character length, λ-expression.


Pattern Match Recursive Function Functional Programming Lambda Calculus Fold Function 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Barendregt, H.: The lambda calculus, its syntax and semantics, revised edition. Studies in Logic, vol. 103. North-Holland (1984)Google Scholar
  2. 2.
    Barendregt, H.: The impact of the lambda calculus in logic and computer science. The Bulletin of Symbolic Logic 3(2), 181–215 (1997)MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Burstall, R.M., MacQueen, D.B., Sannella, D.T.: Hope: An experimental applicative language (1980)Google Scholar
  4. 4.
    Curry, H., Hindley, J., Seldin, J.: Combinatory Logic, vol. 2. North-Holland Publishing Company (1972)Google Scholar
  5. 5.
    Hinze, R.: Theoretical pearl Church numerals, twice? Journal of Functional Programming 15(1), 1–13 (2005)CrossRefzbMATHGoogle Scholar
  6. 6.
    Jansen, J., Koopman, P., Plasmeijer, R.: Efficient interpretation by transforming data types and patterns to functions. In: Nilsson, H. (ed.) Revised Selected Papers of the 7th Trends in Functional Programming 2006, vol. 7, pp. 73–90. Intellect Books, Nottingham (2006)Google Scholar
  7. 7.
    Landin, P.J.: The next 700 programming languages. Commun. ACM 9(3), 157–166 (1966)CrossRefzbMATHGoogle Scholar
  8. 8.
    Mogensen, T.A.: Efficient Self-Interpretation in Lambda Calculus. Journal of Functional Programming 2, 345–364 (1994)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Steensgaard-Madsen, J.: Typed representation of Objects by Functions. ACM Transactions on Programming Languages and Systems 11(1), 67–89 (1989)CrossRefzbMATHGoogle Scholar
  10. 10.
    Stump, A.: Directly reflective meta-programming. Journal of Higher Order and Symbolic Computation (2008)Google Scholar
  11. 11.
    Tromp, J.: John’s lambda calculus and combinatory logic playground (2012),
  12. 12.
    Turner, D.: Some History of Functional Programming Languages. In: Invited talk, Trends in Functional Programming 2012, TFP 2012, St. Andrews, United Kingdom (2012)Google Scholar
  13. 13.
    Turner, D.A.: A new implementation technique for applicative languages. Softw., Pract. Exper. 9(1), 31–49 (1979)CrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Jan Martin Jansen
    • 1
  1. 1.Faculty of Military SciencesNetherlands Defence AcademyDen HelderThe Netherlands

Personalised recommendations