 vote
 |
|
Lazy programming is a general concept of delaying the processing of a function or request until the results are needed. Thinking in terms of lazy programming can help you rid your code of unneeded computation and restructure programs to be more problem-oriented.
In Scheme, for example, lazy programming is explicitly supported through two special constructs. Scheme's delay special form takes a block of code and, rather than executing it, stores the code and its parameters as a promise. If you force the promise to produce a value, it will then run the code. The promise then saves the result, so that future requests for the value will be returned instantly without having to execute the code again.
| | |
| |
|
|