product-map>assoc ( ... sequences quot: ( ... seq -- ... key value ) exemplar -- ... assoc )
Product sequences

Prev:product-map-as ( ... sequences quot: ( ... seq -- ... value ) exemplar -- ... sequence )
Next:product-each ( ... sequences quot: ( ... seq -- ... ) -- ... )


Vocabulary
sequences.product

Inputs
sequencesa sequence
quota quotation with stack effect ( ... seq -- ... key value )
exemplaran assoc


Outputs
assocan assoc


Word description
Calls quot for every element of the cartesian product of sequences and collects the results from quot into an output assoc.

Definition


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