]> gitweb.factorcode.org Git - factor.git/blob - core/sequences/sequences-tests.factor
6d0a132139224895fd3f0db962c82d708fd69b90
[factor.git] / core / sequences / sequences-tests.factor
1 USING: arrays assocs byte-arrays generic.single kernel make math
2 math.functions math.order math.parser math.vectors sbufs
3 sequences sequences.private strings tools.test vectors ;
4 IN: sequences.tests
5
6 { "empty" } [ { } [ "empty" ] [ "not empty" ] if-empty ] unit-test
7 { { 1 } "not empty" } [ { 1 } [ "empty" ] [ "not empty" ] if-empty ] unit-test
8
9 { V{ 1 2 3 4 } } [ 1 5 dup <iota> <slice> >vector ] unit-test
10 { 3 } [ 1 4 dup <iota> <slice> length ] unit-test
11 { 2 } [ 1 3 { 1 2 3 4 } <slice> length ] unit-test
12 { V{ 2 3 } } [ 1 3 { 1 2 3 4 } <slice> >vector ] unit-test
13 { V{ 4 5 } } [ { 1 2 3 4 5 } 2 tail-slice* >vector ] unit-test
14 { V{ 3 4 } } [ 2 4 1 10 dup <iota> <slice> subseq >vector ] unit-test
15 { V{ 3 4 } } [ 0 2 2 4 1 10 dup <iota> <slice> <slice> subseq >vector ] unit-test
16 [ 0 10 "hello" <slice> ] must-fail
17 [ -10 3 "hello" <slice> ] must-fail
18 [ 2 1 "hello" <slice> ] must-fail
19
20 { "cba" } [ "abcdef" 3 head-slice reverse ] unit-test
21
22 { 5040 5040 } [
23     [ 1 2 3 4 5 6 7 ] dup rest-slice
24     [ 1 [ * ] reduce ] bi@
25 ] unit-test
26
27 { 10079 6459 } [
28     [ 1 2 3 4 5 6 7 ] dup rest-slice
29     [ 1 [ [ * ] [ + ] bi* ] reduce-index ] bi@
30 ] unit-test
31
32 { 21 } [
33     { 1 2 3 } { 4 5 6 } 0 [ + + ] [ 0 ] 4dip 2reduce-from
34 ] unit-test
35
36 { 16 } [
37     { 1 2 3 } { 4 5 6 } 0 [ + + ] [ 1 ] 4dip 2reduce-from
38 ] unit-test
39
40 { -541365 } [
41     { 10 21 32 } { 500 600 700 } [ - sq ] [ - ] 2map-reduce
42 ] unit-test
43
44 { 5040 { 1 1 2 6 24 120 720 } }
45 [ { 1 2 3 4 5 6 7 } 1 [ * ] accumulate ] unit-test
46
47 { 64 B{ 1 2 4 16 } }
48 [ B{ 2 2 4 4 } 1 [ * ] accumulate ] unit-test
49
50 { 5040 { 1 1 2 6 24 120 720 } }
51 [ { 1 2 3 4 5 6 7 } 1 [ * ] accumulate! ] unit-test
52
53 { t }
54 [ { 1 2 3 4 5 6 7 } dup 1 [ * ] accumulate! nip eq? ] unit-test
55
56 { { 1 2 6 24 120 720 5040 } }
57 [ { 1 2 3 4 5 6 7 } 1 [ * ] accumulate* ] unit-test
58
59 { B{ 2 4 16 64 } }
60 [ B{ 2 2 4 4 } 1 [ * ] accumulate* ] unit-test
61
62 { { 1 2 6 24 120 720 5040 } }
63 [ { 1 2 3 4 5 6 7 } 1 [ * ] accumulate*! ] unit-test
64
65 { t }
66 [ { 1 2 3 4 5 6 7 } dup 1 [ * ] accumulate*! eq? ] unit-test
67
68 { f f } [ [ ] [ ] find ] unit-test
69 { 0 1 } [ [ 1 ] [ ] find ] unit-test
70 { 1 "world" } [ [ "hello" "world" ] [ "world" = ] find ] unit-test
71 { 2 3 } [ [ 1 2 3 ] [ 2 > ] find ] unit-test
72 { f f } [ [ 1 2 3 ] [ 10 > ] find ] unit-test
73
74 { 1 CHAR: e }
75 [ "hello world" "aeiou" [ member? ] curry find ] unit-test
76
77 { 4 CHAR: o }
78 [ 3 "hello world" "aeiou" [ member? ] curry find-from ] unit-test
79
80 { f f } [ "abcd" [ 10 > nip ] find-index ] unit-test
81 { f f } [ "abcd" [ drop CHAR: e = ] find-index ] unit-test
82 { 3 CHAR: d } [ "abcdefg" [ 3 = nip ] find-index ] unit-test
83 { 3 CHAR: d } [ "abcdefg" [ drop CHAR: d = ] find-index ] unit-test
84
85 { 0 CHAR: a } [ 0 "abcdef" [ drop CHAR: a >= ] find-index-from ] unit-test
86 { 1 CHAR: b } [ 0 "abcdef" [ drop CHAR: a > ] find-index-from ] unit-test
87 { 2 CHAR: c } [ 1 "abcdef" [ drop CHAR: b > ] find-index-from ] unit-test
88
89 { f } [ 3 [ ]     member? ] unit-test
90 { f } [ 3 [ 1 2 ] member? ] unit-test
91 { t } [ 1 [ 1 2 ] member? ] unit-test
92 { t } [ 2 [ 1 2 ] member? ] unit-test
93
94 { t }
95 [ [ "hello" "world" ] [ second ] keep member-eq? ] unit-test
96
97 { 4 } [ CHAR: x "tuvwxyz" >vector index ] unit-test
98
99 { f } [ CHAR: x 5 "tuvwxyz" >vector index-from ] unit-test
100
101 { f } [ CHAR: a 0 "tuvwxyz" >vector index-from ] unit-test
102
103 { f } [ [ "Hello" { } 0.75 ] [ string? ] all? ] unit-test
104 { t } [ [ ] [ ] all? ] unit-test
105 { t } [ [ "hi" t 0.5 ] [ ] all? ] unit-test
106
107 { [ 1 2 3 ] } [ [ 1 4 2 5 3 6 ] [ 4 < ] filter ] unit-test
108 { { 4 2 6 } } [ { 1 4 2 5 3 6 } [ 2 mod 0 = ] filter ] unit-test
109
110 { [ 3 ] } [ [ 1 2 3 ] 2 [ swap < ] curry filter ] unit-test
111
112 { V{ 1 2 3 } } [ V{ 1 4 2 5 3 6 } clone [ 4 < ] filter! ] unit-test
113 { V{ 4 2 6 } } [ V{ 1 4 2 5 3 6 } clone [ 2 mod 0 = ] filter! ] unit-test
114
115 { V{ 3 } } [ V{ 1 2 3 } clone 2 [ swap < ] curry filter! ] unit-test
116 { 4 V{ 1 2 3 } } [ 4 V{ 1 4 2 5 3 6 } [ dupd > ] filter! ] unit-test
117
118 { "hello world how are you" }
119 [ { "hello" "world" "how" "are" "you" } " " join ] unit-test
120
121 { "hello world how are you" }
122 [ { "hello" "world" "how" "are" "you" } " " "" join-as ] unit-test
123
124 { "" } [ { } "" join ] unit-test
125
126 { "" } [ { } "" "" join-as ] unit-test
127
128 { { } } [ { } flip ] unit-test
129
130 { { "b" "e" } } [ 1 { { "a" "b" "c" } { "d" "e" "f" } } flip nth ] unit-test
131
132 { { { 1 4 } { 2 5 } { 3 6 } } }
133 [ { { 1 2 3 } { 4 5 6 } } flip ] unit-test
134
135 { [ 2 3 4 ] } [ [ 1 2 3 ] 1 [ + ] curry map ] unit-test
136
137 { 1 } [ 0 [ 1 2 ] nth ] unit-test
138 { 2 } [ 1 [ 1 2 ] nth ] unit-test
139
140 { [ ]           } [ [ ]   [ ]       append ] unit-test
141 { [ 1 ]         } [ [ 1 ] [ ]       append ] unit-test
142 { [ 2 ]         } [ [ ] [ 2 ]       append ] unit-test
143 { [ 1 2 3 4 ]   } [ [ 1 2 3 ] [ 4 ] append ] unit-test
144 { [ 1 2 3 4 ]   } [ [ 1 2 3 ] { 4 } append ] unit-test
145
146 [ "a" -1 append ] must-fail
147 [ -1 "a" append ] must-fail
148
149 { t } [ B{ 0 } { 1 } append byte-array? ] unit-test
150 { t } [ B{ 0 } { 1 } prepend byte-array? ] unit-test
151
152 { "0123456789" } [ 58 <iota> [ 48 < ] "" reject-as ] unit-test
153
154 { [ ]       } [ 1 [ ]           remove ] unit-test
155 { [ ]       } [ 1 [ 1 ]         remove ] unit-test
156 { [ 3 1 1 ] } [ 2 [ 3 2 1 2 1 ] remove ] unit-test
157
158 { [ ]       } [ [ ]       reverse ] unit-test
159 { [ 1 ]     } [ [ 1 ]     reverse ] unit-test
160 { [ 3 2 1 ] } [ [ 1 2 3 ] reverse ] unit-test
161
162 { f } [ f 0 head ] unit-test
163 { [ ] } [ [ 1 ] 0 head ] unit-test
164 { [ 1 2 3 ] } [ [ 1 2 3 4 ] 3 head ] unit-test
165 { [ ] } [ [ 1 2 3 ] 3 tail ] unit-test
166 { [ 3 ] } [ [ 1 2 3 ] 2 tail ] unit-test
167
168 { "blah" } [ "blahxx" 2 head* ] unit-test
169
170 { "xx" } [ "blahxx" 2 tail* ] unit-test
171
172 { t } [ "xxfoo" 2 head-slice "xxbar" 2 head-slice = ] unit-test
173 { t } [ "xxfoo" 2 head-slice "xxbar" 2 head-slice [ hashcode ] same? ] unit-test
174
175 { t } [ "xxfoo" 2 head-slice SBUF" barxx" 2 tail-slice* = ] unit-test
176 { t } [ "xxfoo" 2 head-slice SBUF" barxx" 2 tail-slice* [ hashcode ] same? ] unit-test
177
178 { t } [ [ 1 2 3 ] [ 1 2 3 ] sequence= ] unit-test
179 { t } [ [ 1 2 3 ] { 1 2 3 } sequence= ] unit-test
180 { t } [ { 1 2 3 } [ 1 2 3 ] sequence= ] unit-test
181 { f } [ [ ] [ 1 2 3 ] sequence= ] unit-test
182
183 { { 1 3 2 4 } } [ { 1 2 3 4 } clone 1 2 pick exchange ] unit-test
184
185 { { "" "a" "aa" "aaa" } }
186 [ 4 [ CHAR: a <string> ] map-integers ]
187 unit-test
188
189 { V{ 1 3 5 7 9 } } [ 10 <iota> >vector [ even? ] reject! ] unit-test
190
191 { V{ } } [ "f" V{ } clone remove! ] unit-test
192 { V{ } } [ "f" V{ "f" } clone remove! ] unit-test
193 { V{ } } [ "f" V{ "f" "f" } clone remove! ] unit-test
194 { V{ "x" } } [ "f" V{ "f" "x" "f" } clone remove! ] unit-test
195 { V{ "y" "x" } } [ "f" V{ "y" "f" "x" "f" } clone remove! ] unit-test
196
197 { V{ 0 1 4 5 } } [ 6 <iota> >vector 2 4 pick delete-slice ] unit-test
198
199 [ 6 >vector 2 8 pick delete-slice ] must-fail
200
201 { V{ } } [ 6 <iota> >vector 0 6 pick delete-slice ] unit-test
202
203 { { 1 2 "a" "b" 5 6 7 } } [
204     { "a" "b" } 2 4 { 1 2 3 4 5 6 7 }
205     replace-slice
206 ] unit-test
207
208 { { 1 2 "a" "b" 6 7 } } [
209     { "a" "b" } 2 5 { 1 2 3 4 5 6 7 }
210     replace-slice
211 ] unit-test
212
213 { { 1 2 "a" "b" 4 5 6 7 } } [
214     { "a" "b" } 2 3 { 1 2 3 4 5 6 7 }
215     replace-slice
216 ] unit-test
217
218 { { 1 2 3 4 5 6 7 "a" "b" } } [
219     { "a" "b" } 7 7 { 1 2 3 4 5 6 7 }
220     replace-slice
221 ] unit-test
222
223 { { "a" 3 } } [
224     { "a" } 0 2 { 1 2 3 } replace-slice
225 ] unit-test
226
227 { { 1 4 9 } } [ { 1 2 3 } clone [ sq ] map! ] unit-test
228
229 { 5 } [ 1 >bignum { 1 5 7 } nth-unsafe ] unit-test
230 { 5 } [ 1 >bignum { 1 5 7 } nth-unsafe ] unit-test
231 { 5 } [ 1 >bignum "\u000001\u000005\u000007" nth-unsafe ] unit-test
232
233 { SBUF" before&after" } [
234     "&" 6 11 SBUF" before and after" replace-slice
235 ] unit-test
236
237 { 3 "a" } [ { "a" "b" "c" "a" "d" } [ "a" = ] find-last ] unit-test
238
239 { f f } [ 100 { 1 2 3 } [ 1 = ] find-from ] unit-test
240 { f f } [ 100 { 1 2 3 } [ 1 = ] find-last-from ] unit-test
241 { f f } [ -1 { 1 2 3 } [ 1 = ] find-from ] unit-test
242
243 { 0 } [ { "a" "b" "c" } { "A" "B" "C" } mismatch ] unit-test
244
245 { 1 } [ { "a" "b" "c" } { "a" "B" "C" } mismatch ] unit-test
246
247 { f } [ { "a" "b" "c" } { "a" "b" "c" } mismatch ] unit-test
248
249 { V{ } V{ } } [ { "a" "b" } { "a" "b" } drop-prefix [ >vector ] bi@ ] unit-test
250
251 { V{ "C" } V{ "c" } } [ { "a" "b" "C" } { "a" "b" "c" } drop-prefix [ >vector ] bi@ ] unit-test
252
253 [ -1 1 "abc" <slice> ] must-fail
254
255 { V{ "a" "b" } V{ } } [ { "X" "a" "b" } { "X" } drop-prefix [ >vector ] bi@ ] unit-test
256
257 [ 0.5 { 1 2 3 } nth ] [ no-method? ] must-fail-with
258 [ 0.5 "asdfasdf" nth ] [ no-method? ] must-fail-with
259
260 ! Pathological case
261 { "ihbye" } [ "hi" <reversed> "bye" append ] unit-test
262
263 { t } [ "hi" <reversed> SBUF" hi" <reversed> = ] unit-test
264
265 { t } [ "hi" <reversed> SBUF" hi" <reversed> = ] unit-test
266
267 { t } [ "hi" <reversed> SBUF" hi" <reversed> [ hashcode ] same? ] unit-test
268
269 [ -10 "hi" "bye" copy ] must-fail
270 [ 10 "hi" "bye" copy ] must-fail
271
272 { V{ 1 2 3 5 6 } } [
273     3 V{ 1 2 3 4 5 6 } clone remove-nth!
274 ] unit-test
275
276 ! erg's random tester found this one
277 { SBUF" 12341234" } [
278     9 <sbuf> dup "1234" swap push-all dup dup swap push-all
279 ] unit-test
280
281 { f } [ f V{ } like f V{ } like eq? ] unit-test
282
283 { V{ f f f } } [ 3 V{ } new-sequence ] unit-test
284 { SBUF" \0\0\0" } [ 3 SBUF" " new-sequence ] unit-test
285
286 { 0 } [ f length ] unit-test
287 [ f first ] must-fail
288 { 3 } [ 3 10 <iota> nth ] unit-test
289 { 3 } [ 3 10 <iota> nth-unsafe ] unit-test
290 [ -3 10 <iota> nth ] must-fail
291 [ 11 10 <iota> nth ] must-fail
292
293 { f } [ f ?first ] unit-test
294 { f } [ { } ?first ] unit-test
295 { 0 } [ 10 <iota> ?first ] unit-test
296
297 { f } [ f ?last ] unit-test
298 { f } [ { } ?last ] unit-test
299 { 9 } [ 10 <iota> ?last ] unit-test
300
301 [ -1/0. 0 remove-nth! ] must-fail
302 { "" } [ "" [ CHAR: \s = ] trim ] unit-test
303 { "" } [ "" [ CHAR: \s = ] trim-head ] unit-test
304 { "" } [ "" [ CHAR: \s = ] trim-tail ] unit-test
305 { "" } [ "  " [ CHAR: \s = ] trim-head ] unit-test
306 { "" } [ "  " [ CHAR: \s = ] trim-tail ] unit-test
307 { "asdf" } [ " asdf " [ CHAR: \s = ] trim ] unit-test
308 { "asdf " } [ " asdf " [ CHAR: \s = ] trim-head ] unit-test
309 { " asdf" } [ " asdf " [ CHAR: \s = ] trim-tail ] unit-test
310
311 { 328350 } [ 100 <iota> [ sq ] map-sum ] unit-test
312
313 { 50 } [ 100 <iota> [ even? ] count ] unit-test
314 { 50 } [ 100 <iota> [ odd?  ] count ] unit-test
315
316 { { "b" "d" } } [ { 1 3 } { "a" "b" "c" "d" } nths ] unit-test
317 { { "a" "b" "c" "d" } } [ { 0 1 2 3 } { "a" "b" "c" "d" } nths ] unit-test
318 { { "d" "c" "b" "a" } } [ { 3 2 1 0 } { "a" "b" "c" "d" } nths ] unit-test
319 { { "d" "a" "b" "c" } } [ { 3 0 1 2 } { "a" "b" "c" "d" } nths ] unit-test
320
321 { "dac" } [ { 3 0 2 } "abcd" nths ] unit-test
322
323 TUPLE: bogus-hashcode ;
324
325 M: bogus-hashcode hashcode* 2drop 0 >bignum ;
326
327 { 0 } [ { T{ bogus-hashcode } } hashcode ] unit-test
328
329 { { 2 4 6 } { 1 3 5 7 } } [ { 1 2 3 4 5 6 7 } [ even? ] partition ] unit-test
330
331 { { 1 3 7 } } [ 2 { 1 3 5 7 } remove-nth ] unit-test
332
333 { { 1 3 "X" 5 7 } } [ "X" 2 { 1 3 5 7 } insert-nth ] unit-test
334
335 { V{ 0 2 } } [ "a" { "a" "b" "a" } indices ] unit-test
336
337 { "a,b" } [ "a" "b" "," glue ] unit-test
338 { "(abc)" } [ "abc" "(" ")" surround ] unit-test
339
340 { "HELLO" } [
341     "HELLO" { -1 -1 -1 -1 -1 } { 2 2 2 2 2 2 }
342     [ * 2 + + ] 3map
343 ] unit-test
344
345 { 3 1 } [ [ 3array ] 3map ] must-infer-as
346
347 { 3 0 } [ [ 3drop ] 3each ] must-infer-as
348
349 { V{ 0 3 } } [ "A" { "A" "B" "C" "A" "D" } indices ] unit-test
350
351 [ "asdf" <iota> ] must-fail
352 [ -1 <iota> ] must-fail
353 { T{ iota { n 10 } } } [ 10 <iota> ] unit-test
354 { 0 } [ 10 <iota> first ] unit-test
355 { 0 } [ 0 <iota> sum ] unit-test
356 { 0 } [ 1 <iota> sum ] unit-test
357 { 10 } [ 5 <iota> sum ] unit-test
358 { 15 } [ 6 <iota> sum ] unit-test
359
360 { "hi" 3 } [
361     { 1 2 3 4 5 6 7 8 } [ H{ { 3 "hi" } } at ] map-find
362 ] unit-test
363
364 { f f } [
365     { 1 2 3 4 5 6 7 8 } [ H{ { 11 "hi" } } at ] map-find
366 ] unit-test
367
368 { { "a" 1 "b" 1 "c" } }
369 [ 1 { "a" "b" "c" } [ [ dup , ] [ , ] interleave drop ] { } make ] unit-test
370
371 { t } [ 0 array-capacity? ] unit-test
372 { f } [ -1 array-capacity? ] unit-test
373
374 { +lt+ } [ { 0 0 0 } { 1 1 1 } <=> ] unit-test
375 { +lt+ } [ { 0 0 0 } { 0 1 1 } <=> ] unit-test
376 { +lt+ } [ { 0 0 0 } { 0 0 0 0 } <=> ] unit-test
377 { +gt+ } [ { 1 1 1 } { 0 0 0 } <=> ] unit-test
378 { +gt+ } [ { 0 1 1 } { 0 0 0 } <=> ] unit-test
379 { +gt+ } [ { 0 0 0 0 } { 0 0 0 } <=> ] unit-test
380 { +eq+ } [ { } { } <=> ] unit-test
381 { +eq+ } [ { 1 2 3 } { 1 2 3 } <=> ] unit-test
382
383 { { { { 1 "a" } { 1 "b" } } { { 2 "a" } { 2 "b" } } } }
384 [ { 1 2 } { "a" "b" } cartesian-product ] unit-test
385
386 { 2 4 } [ { 1 2 3 } { 4 5 6 } [ [ even? ] both? ] cartesian-find ] unit-test
387 { f f } [ { 1 2 3 } { 4 5 6 } [ [ 10 > ] both? ] cartesian-find ] unit-test
388
389 [ { } [ string>digits sum ] [ + ] map-reduce ] must-infer
390 [ { } [ ] [ + ] map-reduce ] must-fail
391 { 4 } [ { 1 1 } [ 1 + ] [ + ] map-reduce ] unit-test
392 { 2 18 } [ 2 { 3 3 3 } [ dupd * ] [ + ] map-reduce ] unit-test
393
394 [ { } { } [ [ string>digits product ] bi@ + ] [ + ] 2map-reduce ] must-infer
395 [ { } { } [ + ] [ + ] 2map-reduce ] must-fail
396 { 24 } [ { 1 2 } { 3 4 } [ + ] [ * ] 2map-reduce ] unit-test
397 { 2 96 } [ 2 { 3 3 3 3 } { 4 4 4 4 } [ [ dup ] 2dip * * ] [ + ] 2map-reduce ] unit-test
398
399 { 4 } [ 5 <iota> [ ] supremum-by ] unit-test
400 { 0 } [ 5 <iota> [ ] infimum-by ] unit-test
401 { "bar" } [ { "bar" "baz" "qux" } [ length ] supremum-by ] unit-test
402 { "bar" } [ { "bar" "baz" "qux" } [ length ] infimum-by ] unit-test
403 { { "foo" } } [ { { "foo" } { "bar" } } [ first ] supremum-by ] unit-test
404 { { "bar" } } [ { { "foo" } { "bar" } } [ first ] infimum-by ] unit-test
405 { -2 1 } [ -2 { 1 2 3 } [ over ^ ] supremum-by ] unit-test
406 { -2 3 } [ -2 { 1 2 3 } [ over ^ ] infimum-by ] unit-test
407
408 { { 0 0 255 } } [
409     {
410         { 0 0 0 }
411         { 95 255 95 }
412         { 215 95 95 }
413         { 95 135 255 }
414         { 135 95 135 }
415         { 135 255 255 }
416         { 0 0 255 }
417         { 0 95 95 }
418         { 0 255 215 }
419         { 135 0 95 }
420         { 255 0 175 }
421     } [ { 0 0 255 } distance ] infimum-by
422 ] unit-test
423
424 [ -1 0 <repetition> ] must-fail
425 { { } } [ 0 0 <repetition> >array ] unit-test
426 { { 0 } } [ 1 0 <repetition> >array ] unit-test
427 { { 0 0 0 } } [ 3 0 <repetition> >array ] unit-test
428
429 { "ABCD" } [ "AAAA" [ + ] map-index ] unit-test
430
431 {
432     { 11 23 35 }
433 } [ { 11 22 33 } [ + ] map-index ] unit-test
434
435 {
436     V{ 11 23 35 }
437 } [ { 11 22 33 } [ + ] V{ } map-index-as ] unit-test
438
439 {
440     B{ 11 23 35 }
441 } [ { 11 22 33 } [ + ] B{ } map-index-as ] unit-test
442
443 {
444     BV{ 11 23 35 }
445 } [ { 11 22 33 } [ + ] BV{ } map-index-as ] unit-test
446
447 { { 0 400 900 } }
448 [ { 10 20 30 } [ sq ] 1 map-from ] unit-test
449
450 { V{ 0 400 900 } }
451 [ { 10 20 30 } [ sq ] 1 V{ } map-from-as ] unit-test
452
453 { t } [ { } { 99 88 } [ <= ] 2all? ] unit-test
454
455 { f } [ { } { 99 88 } [ <= ] 2any? ] unit-test
456 { t } [ { 2 4 5 8 } { 2 4 6 8 } [ < ] 2any? ] unit-test
457 { f } [ { 2 4 6 8 } { 2 4 6 8 } [ < ] 2any? ] unit-test
458
459 { "ollo" } [ "ll" "o" 1surround ] unit-test
460 { "ollo" } [ { CHAR: l CHAR: l } "o" 1surround ] unit-test
461
462 { { CHAR: o CHAR: l CHAR: l CHAR: o } }
463 [ { CHAR: l CHAR: l } "o" { } 1surround-as ] unit-test
464
465 { "ollo" }
466 [ { CHAR: l CHAR: l } "o" "" 1surround-as ] unit-test