3 ms·
It is very rare that the tail-recursive form of a function is more readable than the non-tail recursive form. I find tail-recursion intellectually interesting,
by aidenn0 9y ago
It is very rare that the tail-recursive form of a function is more readable than the non-tail recursive form. I find tail-recursion intellectually interesting, but of little use for actual programming.
Contrasted with tree-recursion where the code is often so pithy that its correctness is obvious (assuming you understand recursion).
- eru 9y agoTail recursion sometimes comes up naturally. It's essentially a goto with parameters. Thus it comes up where goto is also (at least borderline) useful, eg implementing state machines.
- aidenn0 9y agoI almost added a parenthetical after "rarely" to the effect that state-machines are the one exception I've encountered.