For some function f and variable a,
b_1 = f(a),
b_2 = f(b_1),
b_3 = f(b_2)
...
b_n = f(b_n-1)
I would like to do n-times by iterated method. In a functional way, this is accomplished by a function composition.
f...(f(f((a)))
For some function f and variable a,
b_1 = f(a),
b_2 = f(b_1),
b_3 = f(b_2)
...
b_n = f(b_n-1)
I would like to do n-times by iterated method. In a functional way, this is accomplished by a function composition.
f...(f(f((a)))
You can achive your result by recusion
you can refer below pesudo code
#define f(a):
# do computation
# if terminating condition
# then return the computed result
#else
# return f(computed result)