Abstract
The call-by-need lambda calculus provides an equational framework for reasoning syntactically about lazy evaluation. This paper examines its operational characteristics.
By a series of reasoning steps, we systematically unpack the standard-order reduction relation of the calculus and discover a novel abstract machine definition which, like the calculus, goes "under lambdas." We prove that machine evaluation is equivalent to standard-order evaluation.
Unlike traditional abstract machines, delimited control plays a significant role in the machine's behavior. In particular, the machine replaces the manipulation of a heap using store-based effects with disciplined management of the evaluation stack using control-based effects. In short, state is replaced with control.
To further articulate this observation, we present a simulation of call-by-need in a call-by-value language using delimited control operations.
- Martín Abadi, Luca Cardelli, Pierre-Louis Curien, and Jean-Jacques Lévy. Explicit substitutions. Journal of Functional Programming, 1 (4): 375--416, 1991.Google Scholar
Cross Ref
- Zena M. Ariola and Matthias Felleisen. The call-by-need lambda calculus. Journal of Functional Programming, 7 (3): 265--301, May 1997. Google Scholar
Digital Library
- Zena M. Ariola, John Maraist, Martin Odersky, Matthias Felleisen, and Philip Wadler. A call-by-need lambda calculus. In POPL '95: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 233--246, New York, NY, USA, 1995. ACM Press. ISBN 0-89791-692-1. Google Scholar
Digital Library
- Henk P. Barendregt. The Lambda Calculus, its Syntax and Semantics. North-Holland, Amsterdam, NL, 1981. Studies in Logic and the Foundations of Mathematics.Google Scholar
- Malgorzata Biernacka and Olivier Danvy. A concrete framework for environment machines. ACM Transactions on Computational Logic, 9 (1): 6, 2007. ISSN 1529--3785. Google Scholar
Digital Library
- Haskell Brookes Curry and Robert Feys. Combinatory Logic, Volume I. Studies in Logic and the Foundations of Mathematics. North-Holland, Amsterdam, 1958. Second printing 1968.Google Scholar
- Olivier Danvy and Andrzej Filinski. Abstracting control. In LFP '90: Proceedings of the 1990 ACM Conference on LISP and Functional Programming, pages 151--160, New York, NY, USA, 1990. ACM. ISBN 0-89791-368-X. Google Scholar
Digital Library
- Olivier Danvy and Lasse R. Nielsen. Refocusing in reduction semantics. Technical Report RS-04-26, BRICS, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark, November 2004.Google Scholar
Cross Ref
- R. Kent Dybvig, Simon Peyton Jones, and Amr Sabry. A monadic framework for delimited continuations. Journal of Functional Programming, 17 (6): 687--730, 2007. ISSN 0956-7968. Google Scholar
Digital Library
- Matthias Felleisen. The theory and practice of first-class prompts. In POPL '88: Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 180--190, New York, NY, USA, 1988. ACM. ISBN 0-89791-252-7. Google Scholar
Digital Library
- Matthias Felleisen and Matthew Flatt. Programming languages and lambda calculi. Available from http://www.cs.utah.edu/plt/publications/pllc.pdf, January 2002.Google Scholar
- Matthias Felleisen and Daniel P. Friedman. Control operators, the SECD-machine, and the λ-calculus. In M. Wirsing, editor, Formal Description of Programming Concepts, pages 193--217. North-Holland, 1986.Google Scholar
- Matthias Felleisen and Robert Hieb. A revised report on the syntactic theories of sequential control and state. Theoretical Computer Science, 103 (2): 235--271, 1992. Google Scholar
Digital Library
- Daniel P. Friedman and David S. Wise. CONS should not evaluate its arguments. In S. Michaelson and Robin Milner, editors, Automata, Languages and Programming, pages 257--284, Edinburgh, Scotland, 1976. Edinburgh University Press.Google Scholar
- Daniel P. Friedman, Abdulaziz Ghuloum, Jeremy G. Siek, and Onnie Lynn Winebarger. Improving the lazy Krivine machine. Higher-Order and Symbolic Computation, 20 (3): 271--293, 2007. Google Scholar
Digital Library
- Jeremy Gibbons and Keith Wansbrough. Tracing lazy functional languages. In Michael E. Houle and Peter Eades, editors, Proceedings of Conference on Computing: The Australian Theory Symposium, pages 11--20, Townsville, January 29-30 1996. Australian Computer Science Communications. ISBN ISSN 0157-3055.Google Scholar
- Peter Henderson and James H. Morris, Jr. A lazy evaluator. In POPL '76: Proceedings of the 3rd ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pages 95--103, New York, NY, USA, 1976. ACM. Google Scholar
Digital Library
- Yukiyoshi Kameyama, Oleg Kiselyov, and Chung-chieh Shan. Closing the stage: From staged code to typed closures. In PEPM '08: Proceedings of the 2008 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation, pages 147--157, New York, NY, USA, 2008. ACM. ISBN 978-1-59593-977-7. Google Scholar
Digital Library
- Oleg Kiselyov, Chung-chieh Shan, Daniel P. Friedman, and Amr Sabry. Backtracking, interleaving, and terminating monad transformers: (functional pearl). In ICFP '05: Proceedings of the Tenth ACM SIGPLAN International Conference on Functional Programming, pages 192--203, New York, NY, USA, 2005. ACM. ISBN 1-59593-064-7. Google Scholar
Digital Library
- Oleg Kiselyov, Chung-chieh Shan, and Amr Sabry. Delimited dynamic binding. In ICFP '06: Proceedings of the eleventh ACM SIGPLAN international conference on Functional programming, pages 26--37, New York, NY, USA, 2006. ACM. ISBN 1-59593-309-3. Google Scholar
Digital Library
- Jean-Louis Krivine. A call-by-name lambda-calculus machine. Higher-Order and Symbolic Computation, 20 (3): 199--207, 2007. Google Scholar
Digital Library
- John Launchbury. A natural semantics for lazy evaluation. In POPL '93: Proceedings of the 20th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 144--154, New York, NY, USA, 1993. ACM. ISBN 0-89791-560-7. Google Scholar
Digital Library
- John Maraist, Martin Odersky, and Philip Wadler. The call-by-need lambda calculus. Journal of Functional Programming, 8 (3): 275--317, May 1998. Google Scholar
Digital Library
- Eugenio Moggi and Amr Sabry. An abstract monadic semantics for value recursion. Theoretical Informatics and Applications, 38 (4): 375--400, 2004.Google Scholar
Cross Ref
- Chris Okasaki, Peter Lee, and David Tarditi. Call-by-need and continuation-passing style. Lisp and Symbolic Computation, 7 (1): 57--81, January 1994. Google Scholar
Digital Library
- Simon L. Peyton Jones and Jon Salkild. The spineless tagless G-machine. In FPCA '89: Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture, pages 184--201, New York, NY, USA, 1989. ACM. ISBN 0-89791-328-0. Google Scholar
Digital Library
- Gordon D. Plotkin. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, 1 (2): 125--159, December 1975.Google Scholar
Cross Ref
- Peter Sestoft. Deriving a lazy abstract machine. Journal of Functional Programming, 7 (3): 231--264, 1997. Google Scholar
Digital Library
- Chung-chieh Shan. A static simulation of dynamic delimited control. Higher-Order and Symbolic Computation, 20 (4): 371--401, 2007. Google Scholar
Digital Library
- Jay Sussman and Guy L. Steele Jr. Scheme: An interpreter for extended lambda calculus. Higher Order Symbolic Computation, 11 (4): 405--439, 1998. ISSN 1388-3690. Google Scholar
Digital Library
- Mitchell Wand and Dale Vaillancourt. Relating models of backtracking. In ICFP '04: Proceedings of the Ninth ACM SIGPLAN International Conference on Functional Programming, pages 54--65, New York, NY, USA, 2004. ACM. ISBN 1-58113-905-5. Google Scholar
Digital Library
- Ching-lin Wang. Obtaining lazy evaluation with continuations in Scheme. Information Processing Letters, 35 (2): 93--97, 1990. ISSN 0020-0190. Google Scholar
Digital Library
- Hongwei Xi. Evaluation under lambda abstraction. In PLILP '97: Proceedings of the Ninth International Symposium on Programming Languages: Implementations, Logics, and Programs, pages 259--273, London, UK, 1997. Springer-Verlag. ISBN 3-540-63398-7. Google Scholar
Digital Library
Index Terms
Lazy evaluation and delimited control
Recommendations
Lazy evaluation and delimited control
POPL '09: Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesThe call-by-need lambda calculus provides an equational framework for reasoning syntactically about lazy evaluation. This paper examines its operational characteristics.
By a series of reasoning steps, we systematically unpack the standard-order ...
Deriving the full-reducing Krivine machine from the small-step operational semantics of normal order
PPDP '13: Proceedings of the 15th Symposium on Principles and Practice of Declarative ProgrammingWe derive by program transformation Pierre Crégut's full-reducing Krivine machine KN from the structural operational semantics of the normal order reduction strategy in a closure-converted pure lambda calculus. We thus establish the correspondence ...
Taylor Expansion, Finiteness and Strategies
AbstractWe examine some recent methods introduced to extend Ehrhard and Regnier's result on Taylor expansion: infinite linear combinations of approximants of a lambda-term can be normalized while keeping all coefficients finite. The methods considered ...







Comments