Skip to content

Commit 1bf0398

Browse files
committed
update
1 parent d410013 commit 1bf0398

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

python-ffi/Control/Apply.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def arrayApply(fs):
2+
def ap(xs):
3+
return tuple(f(x) for f in fs for x in xs)
4+
5+
return ap

python-ffi/Control/Bind.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def arrayBind(arr):
2+
def kl(f):
3+
res = []
4+
ext = res.extend
5+
for each in arr:
6+
ext(f(each))
7+
return tuple(res)
8+
9+
return kl

python-ffi/Record/Unsafe.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def unsafeHas(label):
2+
return lambda rec: label in rec
3+
4+
5+
def unsafeGet(label):
6+
return lambda rec: rec[label]
7+
8+
9+
def unsafeSet(label):
10+
return lambda val: lambda rec: {**rec, label: val}
11+
12+
13+
def unsafeDelete(label):
14+
def ap(rec):
15+
copy = rec.copy()
16+
del copy[label]
17+
return copy
18+
19+
return ap

0 commit comments

Comments
 (0)