What is “lazy evaluation” in functional programming?
a) A function that runs slower than expected
b) An evaluation strategy where expressions are evaluated only when their value is needed
c) A method of memorizing function calls
d) A technique to create recursive loops
Answer:
b) An evaluation strategy where expressions are evaluated only when their value is needed
Explanation:
Lazy evaluation delays the evaluation of an expression until its value is actually needed, improving performance and reducing unnecessary calculations.