Paste: Attempt at 2cartesian-product
Author: | Loryn Jenkins |
Mode: | factor |
Date: | Mon, 1 Apr 2013 11:34:25 |
Plain Text |
I'm attempting to adapt cartesian-product to 2cartesian-product, in order to produce the cartesian product of 3 sequences. My current (faulty) code is as follows:
: 2cartesian-map
( ... seq1 seq2 seq3 quot: ( ... elt1 elt2 elt3 -- ... newelt ) -- ... newseq )
[ with with map ] 2curry 2over 3map-as ; inline
: 2cartesian-product ( seq1 seq2 -- newseq )
[ { } 3sequence ] 2cartesian-map ;
Three images from my debugging session are posted here:
https://www.evernote.com/pub/lorynjenkins/factorn-cartesian-product
New Annotation