3 ms·
Recursion tends to strip context. That is one of the features, and one of the drawbacks. All problems are either a base case, or the general case. If you are a
by andrewprock 7y ago
Recursion tends to strip context. That is one of the features, and one of the drawbacks. All problems are either a base case, or the general case.
If you are attempting to debug logic, it often helps to have all the context. To do that in recursion, you have to travel up and down the stack, examining local contexts one by one.
- jbjohns 7y agoI'm not sure what you mean here. The only thing I can come up with is you're talking about writing specific code recursively but when doing functional programming we usually just use the applicable recursive function (e.g. map, filter, reduce) in which case we have better context than with a loop because a loop has a lot of irrelevant implementation details cluttering up the context.