ArithFunct/OddMood
ArithFunct/zikilop
f1from math import *f1from math import *
22
33
4def ADD(f, g):4def ADD(f, g):
n5    def foo(i):n5    def foo(x):
6        if callable(f):6        if callable(f):
n7            a = f(i)n7            temp1 = f(x)
8        else:8        else:
n9            a = fn9            temp1 = f
10        if callable(g):10        if callable(g):
n11            b = g(i)n11            temp2 = g(x)
12        else:12        else:
n13            b = gn13            temp2 = g
14        return a + b14        return temp1 + temp2
15    return foo15    return foo
1616
1717
18def SUB(f, g):18def SUB(f, g):
n19    def foo(i):n19    def foo(x):
20        if callable(f):20        if callable(f):
n21            a = f(i)n21            temp1 = f(x)
22        else:22        else:
n23            a = fn23            temp1 = f
24        if callable(g):24        if callable(g):
n25            b = g(i)n25            temp2 = g(x)
26        else:26        else:
n27            b = gn27            temp2 = g
28        return a - b28        return temp1 - temp2
29    return foo29    return foo
3030
3131
32def MUL(f, g):32def MUL(f, g):
n33    def foo(i):n33    def foo(x):
34        if callable(f):34        if callable(f):
n35            a = f(i)n35            temp1 = f(x)
36        else:36        else:
n37            a = fn37            temp1 = f
38        if callable(g):38        if callable(g):
n39            b = g(i)n39            temp2 = g(x)
40        else:40        else:
n41            b = gn41            temp2 = g
42        return a * b42        return temp1 * temp2
43    return foo43    return foo
4444
4545
46def DIV(f, g):46def DIV(f, g):
n47    def foo(i):n47    def foo(x):
48        if callable(f):48        if callable(f):
n49            a = f(i)n49            temp1 = f(x)
50        else:50        else:
n51            a = fn51            temp1 = f
52        if callable(g):52        if callable(g):
n53            b = g(i)n53            temp2 = g(x)
54        else:54        else:
n55            b = gn55            temp2 = g
56        return a / b56        return temp1 / temp2
57    return foo57    return foo
5858
tt59 
60#f = SUB(sin, cos)
61#print(f(12), sin(12)-cos(12))
62 
63#g = DIV(sin, cos)
64#print(g(pi/6), tan(pi/6))
65 
66#h = MUL(exp, 0.1)
67#print(h(2), e**2/10)
68 
69#t = ADD(lambda s: len(s), sum)
70# print(t(range(5)))
71 
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op