Global Information Lookup Global Information

Lazy evaluation information


In programming language theory, lazy evaluation, or call-by-need,[1] is an evaluation strategy which delays the evaluation of an expression until its value is needed (non-strict evaluation) and which also avoids repeated evaluations (by the use of sharing).[2][3]

The benefits of lazy evaluation include:

  • The ability to define control flow (structures) as abstractions instead of primitives.
  • The ability to define potentially infinite data structures. This allows for more straightforward implementation of some algorithms.
  • The ability to define partly-defined data structures where some elements are errors. This allows for rapid prototyping.

Lazy evaluation is often combined with memoization, as described in Jon Bentley's Writing Efficient Programs.[4] After a function's value is computed for that parameter or set of parameters, the result is stored in a lookup table that is indexed by the values of those parameters; the next time the function is called, the table is consulted to determine whether the result for that combination of parameter values is already available. If so, the stored result is simply returned. If not, the function is evaluated, and another entry is added to the lookup table for reuse.

Lazy evaluation is difficult to combine with imperative features such as exception handling and input/output, because the order of operations becomes indeterminate.

The opposite of lazy evaluation is eager evaluation, sometimes known as strict evaluation. Eager evaluation is the evaluation strategy employed in most[quantify] programming languages.

  1. ^ Hudak 1989, p. 384
  2. ^ David Anthony Watt; William Findlay (2004). Programming language design concepts. John Wiley and Sons. pp. 367–368. ISBN 978-0-470-85320-7. Retrieved 30 December 2010.
  3. ^ Reynolds 1998, p. 307
  4. ^ Bentley, Jon Louis. Writing Efficient Programs. Prentice-Hall, 1985. ISBN 978-0139702440

and 21 Related for: Lazy evaluation information

Request time (Page generated in 0.7924 seconds.)

Lazy evaluation

Last Update:

In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an expression until its value...

Word Count : 3606

Evaluation strategy

Last Update:

and some authors define lazy evaluation as normal order evaluation or vice-versa, or confuse non-strictness with lazy evaluation.: 43–44  Boolean expressions...

Word Count : 5172

Functional programming

Last Update:

before invoking the function. Lazy evaluation does not evaluate function arguments unless their values are required to evaluate the function call itself....

Word Count : 8424

Lazy initialization

Last Update:

expensive process until the first time it is needed. It is a kind of lazy evaluation that refers specifically to the instantiation of objects or other resources...

Word Count : 2803

Haskell

Last Update:

statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research, and industrial applications, Haskell...

Word Count : 4530

Lazy loading

Last Update:

Lazy evaluation Lazy initialization "What is Lazy Loading | Lazy vs. Eager Loading | Imperva". Learning Center. Retrieved 2022-02-02. "What Is Lazy Loading...

Word Count : 795

Graph reduction

Last Update:

non-strict evaluation, an evaluation strategy where the arguments to a function are not immediately evaluated. This form of non-strict evaluation is also...

Word Count : 552

Comparison of functional programming languages

Last Update:

"Similar Functional Languages". Retrieved 26 November 2013. "(Scheme) 17. Lazy Evaluation". Retrieved 30 April 2020. "Records - Revised6 Report on the Algorithmic...

Word Count : 817

Purely functional programming

Last Update:

programs are evaluated, since eager evaluation will return the same result as lazy evaluation. However, it is still possible that an eager evaluation may not...

Word Count : 903

Futures and promises

Last Update:

in call by need. Lazy futures are of use in languages which evaluation strategy is by default not lazy. For example, in C++11 such lazy futures can be created...

Word Count : 4616

Lazy systematic unit testing

Last Update:

The term Lazy specification is coined by analogy with lazy evaluation in functional programming. The latter describes the delayed evaluation of sub-expressions...

Word Count : 375

Purely functional data structure

Last Update:

summarized below. Lazy evaluation is particularly interesting in a purely functional language: 31  because the order of the evaluation never changes the...

Word Count : 1392

Strict programming language

Last Update:

allows the user to define non-strict functions, and hence may allow lazy evaluation. In most non-strict languages, the non-strictness extends to data constructors...

Word Count : 572

Lispkit Lisp

Last Update:

programming concepts. It was first used for early experimentation with lazy evaluation. An SECD machine-based implementation written in an ALGOL variant was...

Word Count : 467

Unlambda

Last Update:

are normally eager evaluation, but a lazy evaluation option exists, indicated by the use of the d operator. Usually, to evaluate an expression of the...

Word Count : 957

PureScript

Last Update:

defined as having a strict evaluation strategy, although there are non-conforming back ends which implement a lazy evaluation strategy. PureScript was initially...

Word Count : 714

Partial evaluation

Last Update:

(1993). Partial Evaluation and Automatic Program Generation. Prentice Hall. ISBN 9780130202499. Danvy, O., ed. (1999). "Partial Evaluation and Semantics-Based...

Word Count : 591

Demand paging

Last Update:

article: The Paging Game Page cache Memory management Virtual memory Lazy evaluation Tanenbaum, Andrew S. Operating Systems: Design and Implementation (Second...

Word Count : 534

Referential transparency

Last Update:

optimizing code by means of memoization, common subexpression elimination, lazy evaluation, or parallelization. The concept originated in Alfred North Whitehead...

Word Count : 1468

Boolean expression

Last Update:

use a lazy evaluation, that is, if the value of the expression can be determined from the left hand Boolean expression then they do not evaluate the right...

Word Count : 426

Comparison of programming languages

Last Update:

Comparative Notes on Algol 68 and PL/I – S. H. Valentine – November 1974 1976 – Evaluation of ALGOL 68, JOVIAL J3B, Pascal, Simula 67, and TACPOL Versus TINMAN –...

Word Count : 1473

PDF Search Engine © AllGlobal.net