1 ! Copyright (C) 2006 Matthew Willis and Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: destructors io io.encodings.utf8 io.files kernel lists
4 lists.lazy math sequences tools.test ;
7 { 1 2 3 4 } >list list>array
10 { { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } } [
11 { 1 2 3 } >list { 4 5 } >list 2list lcartesian-product* list>array
14 { { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } } [
15 { 1 2 3 } >list { 4 5 } >list lcartesian-product list>array
19 { 1 2 3 } >list { 4 5 } >list 2list [ + ] lcartesian-map list>array
23 { 1 2 3 } >list { 4 5 } >list 2list { [ drop odd? ] } [ + ] lcartesian-map* list>array
27 3 { 1 2 3 } >list [ + ] with lmap-lazy list>array
31 5 1 [ 2 * ] lfrom-by ltake list>array
34 [ [ ] lmap ] must-infer
35 [ [ ] lmap>array ] must-infer
36 [ [ drop ] foldr ] must-infer
37 [ [ drop ] foldl ] must-infer
38 [ [ drop ] leach ] must-infer
41 { { 1 2 3 } } [ { 1 2 3 4 5 } >list [ 2 > ] luntil list>array ] unit-test
44 "resource:LICENSE.txt" utf8 <file-reader> [
45 llines list>array drop
49 "resource:LICENSE.txt" utf8 <file-reader> [
50 lcontents list>array drop