-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEffect.py
More file actions
55 lines (35 loc) · 713 Bytes
/
Effect.py
File metadata and controls
55 lines (35 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import itertools
def pureE(a):
return lambda: a
def bindE(a):
return lambda f: lambda: f(a())()
def untilE(f):
def ap():
while not f():
pass
return ()
return ap
def whileE(f):
def ap_a(a):
def ap():
while f():
a()
return ()
return ap
return ap_a
def forE(lo):
def ap_hi(hi):
def ap_f(f):
def ap():
for i in range(lo, hi):
f(i)()
return ap
return ap_f
return ap_hi
def foreachE(as_):
def ap_f(f):
def ap():
for a in as_:
f(a)()
return ap
return ap_f