In the exercise you don't explicitly say that a (for) loop should or should not be used. I was first thinking: how do I do this without an actual loop (which is of course possible but a little harder). And then I thought "he probably just wants a regular loop, but then wrapped in a higher order function", which turned out to be very simple.
So, for me, the exercise wasn't super clear. I think it might help to state in the exercise that the solution is basically to wrap a (classic) for loop in a higher order function. Then again: others might feel differently :-)
Hi, me again :-)
In the exercise you don't explicitly say that a (for) loop should or should not be used. I was first thinking: how do I do this without an actual loop (which is of course possible but a little harder). And then I thought "he probably just wants a regular loop, but then wrapped in a higher order function", which turned out to be very simple.
So, for me, the exercise wasn't super clear. I think it might help to state in the exercise that the solution is basically to wrap a (classic) for loop in a higher order function. Then again: others might feel differently :-)