3 ms·
A thunk is saved state whose evaluation has been postponed. a = 1 + 2 if (condition) { print(a) } In a lazy system, if `condition` is not tr
by paulddraper 10y ago
A thunk is saved state whose evaluation has been postponed.
a = 1 + 2
if (condition) {
print(a)
}
In a lazy system, if `condition` is not true, then `a` is never evaluated.
This contrived example would be a poor place to have lazy evaluation though, as the overhead of deferring would exceed the cost of computing 1 + 2 up-front.