1 ! Copyright (C) 2006 Matthew Willis and Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
4 USING: lists lists.lazy tools.test kernel math io sequences ;
8 { 1 2 3 4 } >list list>array
11 [ { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } ] [
12 { 1 2 3 } >list { 4 5 } >list 2list lcartesian-product* list>array
15 [ { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } ] [
16 { 1 2 3 } >list { 4 5 } >list lcartesian-product list>array
20 { 1 2 3 } >list { 4 5 } >list 2list [ first2 + ] lcomp list>array
24 { 1 2 3 } >list { 4 5 } >list 2list { [ first odd? ] } [ first2 + ] lcomp* list>array
28 3 { 1 2 3 } >list [ + ] lazy-map-with list>array