product-map-as ( ... sequences quot: ( ... seq -- ... value ) exemplar -- ... sequence )
Product sequences

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


Vocabulary
sequences.product

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


Outputs
sequencea sequence


Word description
Calls quot for every element of the cartesian product of sequences and collects the results from quot into an output sequence the same type as the exemplar sequence.

Definition


:: product-map-as
( ... sequences quot: ( ... seq -- ... value ) exemplar -- ... sequence )
sequences >array :> sequences 0 sequences product-length
exemplar [| result |
sequences [
clone swap quot dip
[ result set-nth-unsafe ] [ 1 + ] bi
] product-each result
] new-like nip ; inline