The alternative most people probably use is iterative loops, like for loops and while loops and the like, with a mutable variable somewhere. I don’t love it, personally.
I guess the other potential alternative is doing the iteration recursively, but I doubt that’s what most people think of as an alternative to reduce.
The alternative most people probably use is iterative loops, like for loops and while loops and the like, with a mutable variable somewhere. I don’t love it, personally.
I guess the other potential alternative is doing the iteration recursively, but I doubt that’s what most people think of as an alternative to reduce.