@@ -112,7 +112,7 @@ func reduce f [x, ..xs] = fold f x xs
112112
113113test "array reduce" {
114114 assert reduce (+) [1, 2, 3, 4] == 10
115- assert with ( reduce (+) []; false) { when 'mia cancel true }
115+ assert with { reduce (+) []; false } { when 'mia cancel true }
116116 assert reduce (:) [1, 2, 3] == (1:2):3
117117}
118118
@@ -121,7 +121,7 @@ func rreduce f [..xs, x] = rfold f x xs
121121
122122test "array rreduce" {
123123 assert rreduce (+) [1, 2, 3, 4] == 10
124- assert with ( rreduce (+) []; false) { when 'mia cancel true }
124+ assert with { rreduce (+) []; false } { when 'mia cancel true }
125125 assert rreduce (:) [1, 2, 3] == (3:2):1
126126}
127127
@@ -168,31 +168,31 @@ func first [x, .._] = x
168168
169169test "array first" {
170170 assert first [1, 2, 3] == 1
171- assert with ( first []; false) { when 'mia cancel true }
171+ assert with { first []; false } { when 'mia cancel true }
172172}
173173
174174func last [] = yield 'mia
175175func last [.._, x] = x
176176
177177test "array last" {
178178 assert last [1, 2, 3] == 3
179- assert with ( last []; false) { when 'mia cancel true }
179+ assert with { last []; false } { when 'mia cancel true }
180180}
181181
182182func tail [] = yield 'mia
183183func tail [_, ..xs] = xs
184184
185185test "array tail" {
186186 assert tail [1, 2, 3] == [2, 3]
187- assert with ( tail []; false) { when 'mia cancel true }
187+ assert with { tail []; false } { when 'mia cancel true }
188188}
189189
190190func head [] = yield 'mia
191191func head [..xs, _] = xs
192192
193193test "array head" {
194194 assert head [1, 2, 3] == [1, 2]
195- assert with ( head []; false) { when 'mia cancel true }
195+ assert with { head []; false } { when 'mia cancel true }
196196}
197197
198198func slice i fin (arr and typeof 'array) = core::slice i fin arr
@@ -202,10 +202,10 @@ test "array slice" {
202202 assert slice 1 2 [1, 2, 3] == [2]
203203 assert slice 1 1 [1, 2, 3] == []
204204 assert slice 1 3 [1, 2, 3] == [2, 3]
205- assert with ( slice (-1) 2 [1, 2, 3]; false) { when 'arg cancel true }
206- assert with ( slice 2 1 [1, 2, 3]; false) { when 'arg cancel true }
207- assert with ( slice 0 5 [1, 2, 3]; false) { when 'mia cancel true }
208- assert with ( slice 5 5 [1, 2, 3]; false) { when 'mia cancel true }
205+ assert with { slice (-1) 2 [1, 2, 3]; false } { when 'arg cancel true }
206+ assert with { slice 2 1 [1, 2, 3]; false } { when 'arg cancel true }
207+ assert with { slice 0 5 [1, 2, 3]; false } { when 'mia cancel true }
208+ assert with { slice 5 5 [1, 2, 3]; false } { when 'mia cancel true }
209209}
210210
211211func take n (arr and typeof 'array) =
@@ -219,7 +219,7 @@ test "array take" {
219219 assert take 2 [1, 2, 3] == [1, 2]
220220 assert take 3 [1, 2, 3] == [1, 2, 3]
221221 assert take 12 [1, 2, 3] == [1, 2, 3]
222- assert with ( take (-1) [1, 2, 3]; false) { when 'arg cancel true }
222+ assert with { take (-1) [1, 2, 3]; false } { when 'arg cancel true }
223223}
224224
225225func skip n (arr and typeof 'array) =
@@ -233,7 +233,7 @@ test "array skip" {
233233 assert skip 2 [1, 2, 3] == [3]
234234 assert skip 3 [1, 2, 3] == []
235235 assert skip 12 [1, 2, 3] == []
236- assert with ( skip (-1) [1, 2, 3]; false) { when 'arg cancel true }
236+ assert with { skip (-1) [1, 2, 3]; false } { when 'arg cancel true }
237237}
238238
239239func drop n (arr and typeof 'array) =
@@ -247,12 +247,12 @@ test "array drop" {
247247 assert drop 2 [1, 2, 3] == [1]
248248 assert drop 3 [1, 2, 3] == []
249249 assert drop 12 [1, 2, 3] == []
250- assert with ( drop (-1) [1, 2, 3]; false) { when 'arg cancel true }
250+ assert with { drop (-1) [1, 2, 3]; false } { when 'arg cancel true }
251251}
252252
253253func collect iterator =
254254 let arr = [],
255- with ( iterator!(); arr) {
255+ with { iterator!(); arr } {
256256 when 'next(val) then {
257257 push!(arr, val)
258258 become unit
0 commit comments