4 ms·
I think its a bit of a misnomer to say functional programming is the answer because you can call a function instead of doing a loop, because all you're doing is
by raiflip 7y ago
I think its a bit of a misnomer to say functional programming is the answer because you can call a function instead of doing a loop, because all you're doing is shifting responsibility to the function you're calling to implement the iteration (which is probably done via tail recursion in FP language).
Really the answer to avoiding loops via FP is to use tail recursion, but tail recursion is not always more natural than a loop.