3 ms·
It's not an anti pattern. It's actually a zero cost abstraction. Iteration using recursion causes the stack to fill up. You could say reduce can work but ultim
by crimsonalucard 6y ago
It's not an anti pattern. It's actually a zero cost abstraction. Iteration using recursion causes the stack to fill up.
You could say reduce can work but ultimately reduce needs to be implemented using recursion or a for loop. Reduce is a higher level function and therefore not part of the argument.
That being said I do know about Tail recursive optimization. Most language implementations do not support that though.