I have this function definition which takes an r and applies the function
r => (1 to n).foldLeft(r)((rx, _) => f(rx))
n=3 this is equivalent to
I don't like this solution, because it defines a
1 to n which really isn't get used at all, which becomes obvious in the unused parameter
_ in the fold left. This in turn forces me to give a separate name to
rx which feels wrong to me.
Any idea how I can streamLine this code?