Hi,
In python I defined functions:
def foo_1(p): return p + 1
def foo_2(p): return p + 1
def foo_3(p): return p + 1
def foo_4(p): return p + 1
def foo_5(p): return p + 1
I need execute those function as a chain may like this:
foo_1(foo_2(foo_3(foo_4(foo_5(1)))))
May I know if I can push the functions into a list then execute those functions as a chain, also maybe I can give an executing sequence?
lf = [Null,foo_1,foo_2,foo_3,foo_4,foo_5] # Null is for +1 issue here
def execu(lst, seq, raw_para):
# in some way
execu(lf,(1,2,3,4,5), 1) # = foo_1(foo_2(foo_3(foo_4(foo_5(1)))))
execu(lf,(1,2,3), 1) # = foo_1(foo_2(foo_3(1)))
execu(lf,(3,3,3), 1) # = foo_3(foo_3(foo_3(1)))
Thanks!
Rgs,
KC