1 ! Copyright (C) 2013 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: combinators.extras io.files kernel math sequences
7 [ "a" "b" [ " " glue ] once ] unit-test
10 [ "a" "b" "c" [ " " glue ] twice ] unit-test
13 [ "a" "b" "c" "d" [ " " glue ] thrice ] unit-test
15 { { "negative" 0 "positive" } } [
18 { [ 0 > ] [ "positive" ] }
19 { [ 0 < ] [ "negative" ] }
25 { { 1 2 3 } } [ 1 { [ ] [ 1 + ] [ 2 + ] } cleave-array ] unit-test
27 { 2 15 } [ 1 2 3 4 5 6 [ - - ] [ + + ] 3bi* ] unit-test
29 { 2 5 } [ 1 2 3 4 5 6 [ - - ] 3bi@ ] unit-test
31 { 3 1 } [ 1 2 [ + ] keepd ] unit-test
33 { "1" "123" } [ "1" "123" [ length ] [ > ] swap-when ] unit-test
34 { "123" "1" } [ "1" "123" [ length ] [ < ] swap-when ] unit-test
37 { t } [ "resource:" [ exists? ] ?1arg >boolean ] unit-test
38 { f } [ f [ exists? ] ?1arg ] unit-test
39 { f } [ "/homeasdfasdf123123" [ exists? ] ?1arg ] unit-test
43 { [ "there" over subseq-start ] [ cut ] }
50 { [ "foo" over subseq-start ] [ head f ] }
51 { [ "there" over subseq-start ] [ cut ] }
58 { [ "foo" over subseq-start ] [ head f ] }
59 { [ "bar" over subseq-start ] [ cut ] }