When I started writing this question, I didn't think of the easy solution with nested lists, but now anyway want to find one.
Here's an ugly code:
fun0(
fun1(fun2(fun3(arg1))),
fun1(fun2(fun3(arg4))),
fun1(fun2(fun3(arg4))),
fun1(fun2(fun3(arg4))))
Ouch! Names are given for examples. In the real application, their names have no pattern like this.
I played a bit with map(map ...)
and reduce(map ...)
getting wrong results or TypeError
s, before going here and writing this. The simple solution, of course, came while writing the question: use list comprehensions. Something like this (haven't tested yet):
fun0([i(j) for i in (fun1, fun2, fun3) for j in (arg1, arg2, arg3, arg4)])
Still, I'd like to know how is it possible to achieve the same with functional programming tools only?
fun0(map(fun1, map(fun2, map(fun3,
(arg1, arg2, arg3, arg4)))))
There's still a pattern that I think can be removed. I tried map(map, (fun1, ...), (arg1, ...))
but this way Python tried to iterate over each argument and raised errors.