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 and outputs
sequencesa sequence
quota quotation with stack effect ( ... seq -- ... value )
exemplara sequence
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 )
0 :> i! sequences product-length exemplar [| result |
sequences
[ quot call i result set-nth-unsafe i 1 + i! ]
product-each result
] new-like ; inline