Lazy Evaluation

In programming language theory, lazy evaluation is an evaluation strategy that delays the evaluation of an expression until its value is needed and avoids repeated evaluations. Evaluation is the process of getting the root meaning of a piece of code. Many programming languages evaluate expressions immediately, but it can become inefficient as not all expressions are worth evaluating. The opposite of lazy evaluation is strict evaluation, in which an expression is evaluated immediately.

Lazy evaluation is used in combination with memoization, which is an optimization technique used to speed up computer programs by storing results of function calls and returning the cached results when the same inputs occur again. After a function’s value is computed for the parameter, the result is stored in a table that is indexed by the values of the parameter. The next time the function is called, the table is used to determine whether the result of that combination of parameter values is available. If it is, the stored result is returned. If not, the function is evaluated and another entry is added to the table for reuse.

Haskell is a programming language that has fundamentals based on lazy evaluation.

Lazy evaluation benefits

Benefits of lazy evaluation include:

  • Reducing the time complexity of an algorithm by discarding temporary computations and conditionals
  • Allowing the programmer to define potentially infinite data structures
  • Increasing performance by avoiding unnecessary calculations and avoiding error conditions when evaluating compound expressions
  • Reducing the memory footprint since values are created only when needed

While lazy evaluation is beneficial, it does have its drawbacks. It can be difficult to combine with essential features such as exception handling and input/output because the order of operations becomes indeterminate. Lazy evaluation can also introduce memory leaks.

Webopedia Staff
Webopedia Staff
Since 1995, more than 100 tech experts and researchers have kept Webopedia’s definitions, articles, and study guides up to date. For more information on current editorial staff, please visit our About page.

Related Articles


Table of contents What is Software? History of Software Software vs. Hardware Software vs. Hardware Comparison Chart What Types of Software Exist? Saas vs....

Email Address

What is an Email Address? An email address is a designation for an electronic mailbox that sends and receives messages, known as email, on a...

Information Technology (IT) Architect

The information technology architect applies IT resources to meet specific business requirements. The role requires a high degree of technical expertise as well as...

Built-In Function

A built-in function is a function that is already available in a programming language, application, or another tool that can be accessed by end...


Geotargeting is a method of delivering data or content to users based on...

Agile Project Management

Agile project management enables business teams to approach their projects and tasks with...

Private 5G Network

A private 5G network is a private local area network (LAN) that utilizes...