I find myself doing "repeat N" imperative programming quite often, mainly in two different scenarios:
- Advent of Code, where many of the puzzles involve calculating one number, then using that number to process other data, repeatedly.
- Writing tests, particularly UI tests. Often you want to write tests like "hit the button five times to fill the form" or "hit the button fifty times to overflow the debouncer".
Perhaps Github should be surveyed to find out how many have invented their own "loop N times" functions, as was done when standardising Result
was first discussed.