Consider the following series of functions:

def x(a): if callable(a): return lambda i: a(i) else: return a

then

def x(a): def xx(b): if callable(b): return lambda i: a(b(i)) else: return a(b) return xx

then

def x(a): def xx(b): if callable(b): def xxx(c): if callable(c): return lambda i: a(b(c(i))) else: return a(b(c)) return xxx else: return a(b) return xx

and so on...

Two questions:

- how would you write a single recursive or iterative version of this that could handle cases of any depth?
- what would you call what this function x is doing?