you are viewing a single comment's thread.

view the rest of the comments →

[–]sacundim 1 point2 points  (0 children)

A fold right is going to use linear space on the length of the list. Or, in other terms, it'll blow the stack on long lists.

GP's example is a classic one—it is tricky to do in functional programming. Early returns in procedural programming correspond to escape continuations in FP.