product-each ( ... sequences quot: ( ... seq -- ... ) -- ... )
Product sequences

Prev:product-map>assoc ( ... sequences quot: ( ... seq -- ... key value ) exemplar -- ... assoc )
Next:product-find ( ... sequences quot: ( ... seq -- ... ? ) -- ... sequence )


Vocabulary
sequences.product

Inputs
sequencesa sequence
quota quotation with stack effect ( ... seq -- ... )


Outputs
None

Word description
Calls quot for every element of the cartesian product of sequences.

Notes
[ ... ] product-each is equivalent to, but more efficient than, <product-sequence> [ ... ] each.

See also
product-map, product-find

Definition


:: product-each
( ... sequences quot: ( ... seq -- ... ) -- ... )
sequences start-product-iter :> ( ns lengths ) lengths
[ 0 = ] any? [
[ ns lengths end-product-iter? ]
[ ns sequences nths quot call ns lengths product-iter ]
until
] unless ; inline