Consider the following function:
def f(n) : def retfunc(x) : return 1 if n == 0 else x*add(f(n-k) for k in (1..n)) return retfunc
The test
w = f(9); print w, type(w)
gives
"function retfunc at 0x43d3de8" "type 'function'"
which looks fine to me. However an evaluation w(3) gives
TypeError: unsupported operand type(s) for +: 'int' and 'function'
How can I get around this error?