HOME

TheInfoList



OR:

In
programming language theory Programming language theory (PLT) is a branch of computer science that deals with the design, implementation, analysis, characterization, and classification of formal languages known as programming languages. Programming language theory is clos ...
, lazy evaluation, or call-by-need, is an
evaluation strategy In a programming language, an evaluation strategy is a set of rules for evaluating expressions. The term is often used to refer to the more specific notion of a ''parameter-passing strategy'' that defines the kind of value that is passed to the f ...
which delays the evaluation of an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, ...
until its value is needed ( non-strict evaluation) and which also avoids repeated evaluations (
sharing Sharing is the joint use of a resource or space. It is also the process of dividing and distributing. In its narrow sense, it refers to joint or alternating use of inherently finite goods, such as a common pasture or a shared residence. Still ...
). The benefits of lazy evaluation include: * The ability to define
control flow In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an ''im ...
(structures) as abstractions instead of primitives. * The ability to define potentially infinite
data structure In computer science, a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data values, the relationships among them, a ...
s. This allows for more straightforward implementation of some algorithms. * The ability to define partially-defined data structures where some elements are errors. This allows for rapid prototyping. Lazy evaluation is often combined with
memoization In computing, memoization or memoisation is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again. Memoization ...
, as described in Jon Bentley's ''Writing Efficient Programs''. After a function's value is computed for that parameter or set of parameters, the result is stored in a
lookup table In computer science, a lookup table (LUT) is an array that replaces runtime computation with a simpler array indexing operation. The process is termed as "direct addressing" and LUTs differ from hash tables in a way that, to retrieve a value v w ...
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 In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, a ...
and
input/output In computing, input/output (I/O, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, possibly a human or another information processing system. Inputs are the signals ...
, because the order of operations becomes indeterminate. The opposite of lazy evaluation is
eager evaluation In a programming language, an evaluation strategy is a set of rules for evaluating expressions. The term is often used to refer to the more specific notion of a ''parameter-passing strategy'' that defines the kind of value that is passed to the f ...
, sometimes known as strict evaluation. Eager evaluation is the evaluation strategy employed in most
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
s.


History

Lazy evaluation was introduced for
lambda calculus Lambda calculus (also written as ''λ''-calculus) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation th ...
by Christopher Wadsworth and employed by the
Plessey System 250 Plessey System 250, also known as PP250, was the first operational computer to implement capability-based addressing, to check and balance the computation as a pure Church–Turing machine. Plessey built the systems for a British Army message rou ...
as a critical part of a Lambda-Calculus Meta-Machine, reducing the resolution overhead for access to objects in a capability-limited address space. For programming languages, it was independently introduced by Peter Henderson and James H. Morris and by Daniel P. Friedman and David S. Wise.


Applications

Delayed evaluation is used particularly in
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that ...
languages. When using delayed evaluation, an expression is not evaluated as soon as it gets bound to a variable, but when the evaluator is forced to produce the expression's value. That is, a statement such as x = expression; (i.e. the assignment of the result of an expression to a variable) clearly calls for the expression to be evaluated and the result placed in x, but what actually is in x is irrelevant until there is a need for its value via a reference to x in some later expression whose evaluation could itself be deferred, though eventually the rapidly growing tree of dependencies would be pruned to produce some symbol rather than another for the outside world to see.


Control structures

Lazy evaluation allows control structures to be defined normally, and not as primitives or compile-time techniques. For example one can define
if-then-else In computer science, conditionals (that is, conditional statements, conditional expressions and conditional constructs,) are programming language commands for handling decisions. Specifically, conditionals perform different computations or actio ...
and
short-circuit evaluation A short circuit (sometimes abbreviated to short or s/c) is an electrical circuit that allows a current to travel along an unintended path with no or very low electrical impedance. This results in an excessive current flowing through the circui ...
operators: ifThenElse True b c = b ifThenElse False b c = c -- or True , , b = True False , , b = b -- and True && b = b False && b = False These have the usual semantics, i.e. evaluates (a), then if and only if (a) evaluates to true does it evaluate (b), otherwise it evaluates (c). That is, exactly one of (b) or (c) will be evaluated. Similarly for , if the easy part gives True the lots of work expression could be avoided. Finally, when evaluating , if ''SafeToTry'' is false there will be no attempt at evaluating the ''Expression''. Conversely, in an eager language the above definition for would evaluate (a), (b), and (c) regardless of the value of (a). This is not the desired behavior, as (b) or (c) may have
side effects In medicine, a side effect is an effect, whether therapeutic or adverse, that is secondary to the one intended; although the term is predominantly employed to describe adverse effects, it can also apply to beneficial, but unintended, consequence ...
, take a long time to compute, or throw errors. It is usually possible to introduce user-defined lazy control structures in eager languages as functions, though they may depart from the language's syntax for eager evaluation: Often the involved code bodies need to be wrapped in a function value, so that they are executed only when called.


Working with infinite data structures

Delayed evaluation has the advantage of being able to create calculable infinite lists without infinite loops or size matters interfering in computation. The actual values are only computed when needed. For example, one could create a function that creates an infinite list (often called a ''
stream A stream is a continuous body of surface water flowing within the bed and banks of a channel. Depending on its location or certain characteristics, a stream may be referred to by a variety of local or regional names. Long large streams are ...
'') of
Fibonacci number In mathematics, the Fibonacci numbers, commonly denoted , form a sequence, the Fibonacci sequence, in which each number is the sum of the two preceding ones. The sequence commonly starts from 0 and 1, although some authors start the sequence from ...
s. The calculation of the ''n''-th Fibonacci number would be merely the extraction of that element from the infinite list, forcing the evaluation of only the first n members of the list. Take for example this trivial program in Haskell: numberFromInfiniteList :: Int -> Int numberFromInfiniteList n = infinity !! n - 1 where infinity = .. main = print $ numberFromInfiniteList 4 In the function , the value of is an infinite range, but until an actual value (or more specifically, a specific value at a certain index) is needed, the list is not evaluated, and even then it is only evaluated as needed (that is, until the desired index.) Provided the programmer is careful, the program completes normally. However, certain calculations may result in the program attempting to evaluate an infinite number of elements; for example, requesting the length of the list or trying to sum the elements of the list with a fold operation would result in the program either failing to terminate or running
out of memory Out of memory (OOM) is an often undesired state of computer operation where no additional memory can be allocated for use by programs or the operating system. Such a system will be unable to load any additional programs, and since many programs ...
. As another example, the list of all Fibonacci numbers can be written in the
Haskell Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lang ...
programming language as: fibs = 0 : 1 : zipWith (+) fibs (tail fibs) In Haskell syntax, ":" prepends an element to a list, tail returns a list without its first element, and zipWith uses a specified function (in this case addition) to combine corresponding elements of two lists to produce a third.


List-of-successes pattern


Other uses

In computer
windowing system In computing, a windowing system (or window system) is software that manages separately different parts of display screens. It is a type of graphical user interface (GUI) which implements the WIMP (windows, icons, menus, pointer) paradigm fo ...
s, the painting of information to the screen is driven by ''expose events'' which drive the display code at the last possible moment. By doing this, windowing systems avoid computing unnecessary display content updates.Lazy and Speculative Execution
Butler Lampson
Microsoft Research Microsoft Research (MSR) is the research subsidiary of Microsoft. It was created in 1991 by Richard Rashid, Bill Gates and Nathan Myhrvold with the intent to advance state-of-the-art computing and solve difficult world problems through technologi ...
OPODIS, Bordeaux, France 12 December 2006
Another example of laziness in modern computer systems is copy-on-write page allocation or
demand paging In computer operating systems, demand paging (as opposed to anticipatory paging) is a method of virtual memory management. In a system that uses demand paging, the operating system copies a disk page into physical memory only if an attempt is ma ...
, where memory is allocated only when a value stored in that memory is changed. Laziness can be useful for high performance scenarios. An example is the Unix
mmap In computing, mmap(2) is a POSIX-compliant Unix system call that maps files or devices into memory. It is a method of memory-mapped file I/O. It implements demand paging because file contents are not immediately read from disk and initially use no ...
function, which provides ''demand driven'' loading of pages from disk, so that only those pages actually touched are loaded into memory, and unneeded memory is not allocated.
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementatio ...
implements '' copy on edit'', where arrays which are copied have their actual memory storage replicated only when their content is changed, possibly leading to an ''out of memory'' error when updating an element afterwards instead of during the copy operation.


Performance

The number of beta reductions to reduce a lambda term with call-by-need is no larger than the number needed by call-by-value or
call-by-name In a programming language, an evaluation strategy is a set of rules for evaluating expressions. The term is often used to refer to the more specific notion of a ''parameter-passing strategy'' that defines the kind of value that is passed to the ...
reduction. And with certain programs the number of steps may be much smaller, for example a specific family of lambda terms using Church numerals take an infinite amount of steps with call-by-value (i.e. never complete), an exponential number of steps with call-by-name, but only a polynomial number with call-by-need. Call-by-need embodies two optimizations - never repeat work (similar to call-by-value), and never perform unnecessary work (similar to call-by-name). Lazy evaluation can also lead to reduction in memory footprint, since values are created when needed. In practice, lazy evaluation may cause significant performance issues compared to eager evaluation. For example, on modern computer architectures, delaying a computation and performing it later is slower than performing it immediately. This can be alleviated through
strictness analysis In computer science, strictness analysis refers to any algorithm used to prove that a function in a non-strict functional programming language is strict in one or more of its arguments. This information is useful to compilers because strict functi ...
. Lazy evaluation can also introduce
memory leak In computer science, a memory leak is a type of resource leak that occurs when a computer program incorrectly manages memory allocations in a way that memory which is no longer needed is not released. A memory leak may also happen when an objec ...
s due to unevaluated expressions.


Implementation

Some programming languages delay evaluation of expressions by default, and some others provide functions or special
syntax In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituency ...
to delay evaluation. In Miranda and
Haskell Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lang ...
, evaluation of function arguments is delayed by default. In many other languages, evaluation can be delayed by explicitly suspending the computation using special syntax (as with Scheme's "delay" and "force" and
OCaml OCaml ( , formerly Objective Caml) is a general-purpose, multi-paradigm programming language which extends the Caml dialect of ML with object-oriented features. OCaml was created in 1996 by Xavier Leroy, Jérôme Vouillon, Damien Doligez, Di ...
's "lazy" and "Lazy.force") or, more generally, by wrapping the expression in a
thunk In computer programming, a thunk is a subroutine used to inject a calculation into another subroutine. Thunks are primarily used to delay a calculation until its result is needed, or to insert operations at the beginning or end of the other subro ...
. The object representing such an explicitly delayed evaluation is called a '' lazy future.'' Raku uses lazy evaluation of lists, so one can assign infinite lists to variables and use them as arguments to functions, but unlike Haskell and Miranda, Raku does not use lazy evaluation of arithmetic operators and functions by default.


Laziness and eagerness


Controlling eagerness in lazy languages

In lazy programming languages such as Haskell, although the default is to evaluate expressions only when they are demanded, it is possible in some cases to make code more eager—or conversely, to make it more lazy again after it has been made more eager. This can be done by explicitly coding something which forces evaluation (which may make the code more eager) or avoiding such code (which may make the code more lazy). ''Strict'' evaluation usually implies eagerness, but they are technically different concepts. However, there is an optimisation implemented in some compilers called
strictness analysis In computer science, strictness analysis refers to any algorithm used to prove that a function in a non-strict functional programming language is strict in one or more of its arguments. This information is useful to compilers because strict functi ...
, which, in some cases, allows the compiler to infer that a value will always be used. In such cases, this may render the programmer's choice of whether to force that particular value or not, irrelevant, because strictness analysis will force strict evaluation. In Haskell, marking constructor fields strict means that their values will always be demanded immediately. The seq function can also be used to demand a value immediately and then pass it on, which is useful if a constructor field should generally be lazy. However, neither of these techniques implements ''recursive'' strictness—for that, a function called deepSeq was invented. Also,
pattern matching In computer science, pattern matching is the act of checking a given sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be exact: "either it will or will not be ...
in Haskell 98 is strict by default, so the ~ qualifier has to be used to make it lazy.


Simulating laziness in eager languages


Java

In
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's most ...
, lazy evaluation can be done by using objects that have a method to evaluate them when the value is needed. The body of this method must contain the code required to perform this evaluation. Since the introduction of
lambda expressions Lambda expression may refer to: *Lambda expression in computer programming, also called an anonymous function In computer programming, an anonymous function (function literal, lambda abstraction, lambda function, lambda expression or block) is a f ...
in Java SE8, Java has supported a compact notation for this. The following example
generic Generic or generics may refer to: In business * Generic term, a common name used for a range or class of similar things not protected by trademark * Generic brand, a brand for a product that does not have an associated brand or trademark, other ...
interface provides a framework for lazy evaluation:Grzegorz Piwowarek
Leveraging Lambda Expressions for Lazy Evaluation in Java4Comprehension
July 25, 2018.
Douglas W. Jones
CS:2820 Notes, Fall 2020, Lecture 25
retrieved Jan. 2021.
interface Lazy The Lazy interface with its eval() method is equivalent to the Supplier interface with its get() method in the java.util.function library. Each class that implements the Lazy interface must provide an eval method, and instances of the class may carry whatever values the method needs to accomplish lazy evaluation. For example, consider the following code to lazily compute and print 210: Lazy a = ()-> 1; for (int i = 1; i <= 10; i++) System.out.println( "a = " + a.eval() ); In the above, the variable initially refers to a lazy integer object created by the lambda expression ()->1. Evaluating this lambda expression is similar to constructing a new instance of an
anonymous class In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state ( member variables) and implementations of behavior (member functions or methods). In many languages, the clas ...
that implements Lazy with an method returning . Each iteration of the loop links to a new object created by evaluating the lambda expression inside the loop. Each of these objects holds a reference to another lazy object, , and has an method that calls b.eval() twice and returns the sum. The variable is needed here to meet Java's requirement that variables referenced from within a lambda expression be final. This is an inefficient program because this implementation of lazy integers does not memoize the result of previous calls to . It also involves considerable autoboxing and unboxing. What may not be obvious is that, at the end of the loop, the program has constructed a
linked list In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes whi ...
of 11 objects and that all of the actual additions involved in computing the result are done in response to the call to a.eval() on the final line of code. This call
recursively Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics ...
traverses the list to perform the necessary additions. We can build a Java class that memoizes a lazy objects as follows: class Memo implements Lazy This allows the previous example to be rewritten to be far more efficient. Where the original ran in time exponential in the number of iterations, the memoized version runs in linear time: Lazy a = ()-> 1; for (int i = 1; i <= 10; i++) System.out.println( "a = " + a.eval() ); Note that Java's lambda expressions are just
syntactic sugar In computer science, syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for human use: things can be expressed more clearly, more concisely, or in a ...
. Anything you can write with a lambda expression can be rewritten as a call to construct an instance of an anonymous
inner class In object-oriented programming (OOP), an inner class or nested class is a class declared entirely within the body of another class or interface. It is distinguished from a subclass. Overview An instance of a normal or top-level class can exist on ...
implementing the interface, and any use of an anonymous inner class can be rewritten using a named inner class, and any named inner class can be moved to the outermost nesting level.


JavaScript

In
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, often ...
, lazy evaluation can be simulated by using a generator. For example, the
stream A stream is a continuous body of surface water flowing within the bed and banks of a channel. Depending on its location or certain characteristics, a stream may be referred to by a variety of local or regional names. Long large streams are ...
of all
Fibonacci numbers In mathematics, the Fibonacci numbers, commonly denoted , form a sequence, the Fibonacci sequence, in which each number is the sum of the two preceding ones. The sequence commonly starts from 0 and 1, although some authors start the sequence from ...
can be written, using
memoization In computing, memoization or memoisation is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again. Memoization ...
, as: /** * Generator functions return generator objects, which reify lazy evaluation. * @return A non-null generator of integers. */ function* fibonacciNumbers() let stream = fibonacciNumbers(); // create a lazy evaluated stream of numbers let first10 = Array.from(new Array(10), () => stream.next().value); // evaluate only the first 10 numbers console.log(first10); // the output is n, 1n, 1n, 2n, 3n, 5n, 8n, 13n, 21n, 34n


Python

In
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pr ...
2.x the range() function computes a list of integers. The entire list is stored in memory when the first assignment statement is evaluated, so this is an example of eager or immediate evaluation: >>> r = range(10) >>> print r , 1, 2, 3, 4, 5, 6, 7, 8, 9>>> print r 3 In Python 3.x the range() function returns a generator which computes elements of the list on demand. Elements are only generated when they are needed (e.g., when print(r is evaluated in the following example), so this is an example of lazy or deferred evaluation: >>> r = range(10) >>> print(r) range(0, 10) >>> print(r 3 :This change to lazy evaluation saves execution time for large ranges which may never be fully referenced and memory usage for large ranges where only one or a few elements are needed at any time. In Python 2.x is possible to use a function called xrange() which returns an object that generates the numbers in the range on demand. The advantage of xrange is that generated object will always take the same amount of memory. >>> r = xrange(10) >>> print(r) xrange(10) >>> lst = for x in r>>> print(lst) , 1, 2, 3, 4, 5, 6, 7, 8, 9 From version 2.2 forward, Python manifests lazy evaluation by implementing iterators (lazy sequences) unlike tuple or list sequences. For instance (Python 2): >>> numbers = range(10) >>> iterator = iter(numbers) >>> print numbers , 1, 2, 3, 4, 5, 6, 7, 8, 9>>> print iterator >>> print iterator.next() 0 :The above example shows that lists are evaluated when called, but in case of iterator, the first element '0' is printed when need arises.


.NET Framework

In the
.NET Framework The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
it is possible to do lazy evaluation using the class System.Lazy. The class can be easily exploited in F# using the lazy keyword, while the force method will force the evaluation. There are also specialized collections like Microsoft.FSharp.Collections.Seq that provide built-in support for lazy evaluation. let fibonacci = Seq.unfold (fun (x, y) -> Some(x, (y, x + y))) (0I,1I) fibonacci , > Seq.nth 1000 In C# and VB.NET, the class System.Lazy is directly used. public int Sum() Or with a more practical example: // recursive calculation of the n'th fibonacci number public int Fib(int n) public void Main() Another way is to use the yield keyword: // eager evaluation public IEnumerable Fibonacci(int x) // lazy evaluation public IEnumerable LazyFibonacci(int x)


See also

* Combinatory logic * Currying *
Dataflow In computing, dataflow is a broad concept, which has various meanings depending on the application and context. In the context of software architecture, data flow relates to stream processing or reactive programming. Software architecture Dataf ...
*
Eager evaluation In a programming language, an evaluation strategy is a set of rules for evaluating expressions. The term is often used to refer to the more specific notion of a ''parameter-passing strategy'' that defines the kind of value that is passed to the f ...
*
Functional programming In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that ...
*
Futures and promises In computer science, future, promise, delay, and deferred refer to constructs used for synchronizing program execution in some concurrent programming languages. They describe an object that acts as a proxy for a result that is initially unknown ...
*
Generator (computer programming) In computer science, a generator is a routine that can be used to control the iteration behaviour of a loop. All generators are also iterators. A generator is very similar to a function that returns an array, in that a generator has parameters ...
*
Graph reduction In computer science, graph reduction implements an efficient version of non-strict evaluation, an evaluation strategy where the arguments to a function are not immediately evaluated. This form of non-strict evaluation is also known as lazy evaluati ...
*
Incremental computing Incremental computing, also known as incremental computation, is a software feature which, whenever a piece of data changes, attempts to save time by only recomputing those outputs which depend on the changed data. When incremental computing is su ...
– a related concept whereby computations are only repeated if their inputs change. May be combined with lazy evaluation. *
Lambda calculus Lambda calculus (also written as ''λ''-calculus) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation th ...
*
Lazy initialization In computer programming, lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed. It is a kind of lazy evaluation that refers specifical ...
* Look-ahead *
Non-strict programming language A strict programming language is a programming language which employs a strict programming paradigm, allowing only strict functions (functions whose parameters must be evaluated completely before they may be called) to be defined by the user. A n ...
* Normal order evaluation *
Short-circuit evaluation A short circuit (sometimes abbreviated to short or s/c) is an electrical circuit that allows a current to travel along an unintended path with no or very low electrical impedance. This results in an excessive current flowing through the circui ...
(minimal)


Notes


References


Further reading

* * * * * {{cite book , doi=10.1145/158511.158618 , chapter=A natural semantics for lazy evaluation , title=Proceedings of the 20th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '93 , year=1993 , last1=Launchbury , first1=John , pages=144–154 , isbn=0897915607 , s2cid=14945994


External links


Lazy evaluation macros
in
Nemerle Nemerle is a general-purpose, high-level, statically typed programming language designed for platforms using the Common Language Infrastructure ( .NET/ Mono). It offers functional, object-oriented, aspect-oriented, reflective and imperative f ...

Lambda calculus in Boost Libraries
in
C++ C, or c, is the third letter in the Latin alphabet, used in the modern English alphabet, the alphabets of other western European languages and others worldwide. Its name in English is ''cee'' (pronounced ), plural ''cees''. History "C" ...
language
Lazy Evaluation
in ANSI
C++ C, or c, is the third letter in the Latin alphabet, used in the modern English alphabet, the alphabets of other western European languages and others worldwide. Its name in English is ''cee'' (pronounced ), plural ''cees''. History "C" ...
by writing code in a style which uses classes to implement function closures. Evaluation strategy Compiler optimizations Implementation of functional programming languages Articles with example Haskell code