File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,24 @@ chain = fn ...iterables:
30
30
...iterable
31
31
32
32
33
+
33
34
insert_at = fn idx, insert_items: fn items:
35
+ ignore = {}
36
+
34
37
pipe items:
38
+ chain ?, [ignore]
39
+
35
40
map item, curr=0:
36
41
all = match curr:
37
42
idx: chain insert_items, [item]
38
43
else: [item]
39
44
40
45
(...all, curr + 1)
41
46
47
+ filter item:
48
+ item != ignore
49
+
50
+
42
51
43
52
cycle = fn iterable:
44
53
pipe [...iterable]:
Original file line number Diff line number Diff line change @@ -76,6 +76,20 @@ describe 'iter - transforming funcs', fn:
76
76
to_equal
77
77
'123abc456'
78
78
79
+ expect
80
+ pipe '1':
81
+ insert_at 0, 'abc'
82
+ join ''
83
+ to_equal
84
+ 'abc1'
85
+
86
+ expect
87
+ pipe '1':
88
+ insert_at 1, 'abc'
89
+ join ''
90
+ to_equal
91
+ '1abc'
92
+
79
93
80
94
it 'creates unique set of items', fn:
81
95
expect
You can’t perform that action at this time.
0 commit comments