Back to Fpinscala

07.Answer

answerkey/datastructures/07.answer.md

latest290 B
Original Source

No, this is not possible! The reason is because before we ever call our function, f, we evaluate its argument, which in the case of foldRight means traversing the list all the way to the end. We need non-strict evaluation to support early termination---we discuss this in chapter 5.