The lazy evaluation feature is needed to handle recursive data structures like trees and graphs 懶惰求值的特性常用在處理像tree或者graph這樣的遞歸數(shù)據(jù)結(jié)構(gòu)上。
One example of a lazy evaluation is a function that generates an infinite list of fibonacci numbers , but where the computation of the 一個(gè)懶惰計(jì)算的例子是生成無窮fibonacci列表的函數(shù),但是對第n個(gè)
In lazy evaluation , an expression is not evaluated as soon as it is bound to a variable , but when the evaluator is forced to produce the expression s value 在懶惰計(jì)算中,表達(dá)式不是在綁定到變量時(shí)立即計(jì)算,而是在求值程序需要產(chǎn)生表達(dá)式的值時(shí)進(jìn)行計(jì)算。
百科解釋
In programming language theory, lazy evaluation or call-by-need 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 (sharing). The sharing can reduce the running time of certain functions by an exponential factor over other non-strict evaluation strategies, such as call-by-name.