Hi there,

I have a function `computeNextValue`

such as for a given number x, it computes the number y, by additioning all digits of number x to itself

ex : Given x = 45: y = 54 = 4 + 5 + 45

computeNextValue : Int → Int

computeNextValue x =

List.sum (numberToList x) + x

and i want to mplement the function `computeNextValueWithIteration`

with the following signature :

computeNextValueWithIteration : Int → Int → Int

The first parameter will be an “iteration” value, the second parameter will be the “number” value such that I compute “iteration” number of times to get the result y.

ex : Given x = 123 and iteration = 3, you would compute why like this :

- Iteration 1 : 129 = 1 + 2 + 3 + 123
- Iteration 2 : 141 = 1 + 2 + 9 + 129
- Iteration 3 : 147 = 1 + 4 + 1 + 141

y = 147

can you please give me a feedback about my function computeNextValueWithIteration

computeNextValueWithIteration : Int → Int → Int

computeNextValueWithIteration n x=

case n of

1-> computeNextValue x

_-> computeNextValueWithIteration (n - 1) (computeNextValue x)

thank youu