4 ms·
You can do this in any language, functional or not. Every language has recursion, every language has a simple one liner way to do reduce. They have generally h
by mattmanser 6y ago
You can do this in any language, functional or not. Every language has recursion, every language has a simple one liner way to do reduce.
They have generally had them for over a decade now.
I don't know if it's the case any more as I mainly work alone, but I often saw new programmers had been taught about recursion, but didn't actually understand it. So they never used the concept until you pointed it out, even if it could vastly simplify their code.
- willtim 6y ago> You can do this in any language, functional or not. No, not in practice. For example, in an average imperative language, you'd have no tail-call optimisation, and so would run out of stack space pretty quickly. There'd also be no persistent collections, meaning you'd have to keep copying any sets of values for every recursive call with absymal complexity. And so on...
- deleted 6y ago[deleted]