n | | n | def ADD(f, g): |
| | | def newfun(x): |
| | | fnew = f(x) if callable(f) else f |
| | | gnew = g(x) if callable(g) else g |
| | | return fnew + gnew |
| | | return newfun |
| | | |
| | | |
| def SUB(f, g): | | def SUB(f, g): |
n | def cook(n): | n | def newfun(x): |
| a = f(n) if callable(f) else f | | fnew = f(x) if callable(f) else f |
| b = g(n) if callable(g) else g | | gnew = g(x) if callable(g) else g |
| return a-b | | return fnew - gnew |
| return cook | | return newfun |
| | | |
| | | |
| | | def MUL(f, g): |
| | | def newfun(x): |
| | | fnew = f(x) if callable(f) else f |
| | | gnew = g(x) if callable(g) else g |
| | | return fnew * gnew |
| | | return newfun |
| | | |
| | | |
| def DIV(f, g): | | def DIV(f, g): |
n | def cook(n): | n | def newfun(x): |
| a = f(n) if callable(f) else f | | fnew = f(x) if callable(f) else f |
| b = g(n) if callable(g) else g | | gnew = g(x) if callable(g) else g |
| return a/b | | return fnew / gnew |
| return cook | | return newfun |
| | | |
t | | t | |
| def MUL(f, g): | | |
| def cook(n): | | |
| a = f(n) if callable(f) else f | | |
| b = g(n) if callable(g) else g | | |
| return a*b | | |
| return cook | | |
| | | |
| | | |
| def ADD(f, g): | | |
| def cook(n): | | |
| a = f(n) if callable(f) else f | | |
| b = g(n) if callable(g) else g | | |
| return a+b | | |
| return cook | | |
| | | |