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


:: product-map-as ( ... sequences quot: ( ... seq -- ... value ) exemplar -- ... sequence )
    0 :> i!
    sequences [ length ] [ * ] map-reduce exemplar
    [| result |
        sequences [ quot call i result set-nth i 1 + i! ] product-each
        result
    ] new-like ; inline


! (c)2009 Joe Groff bsd license
USING: accessors arrays assocs kernel locals math sequences
sequences.private ;
FROM: sequences => change-nth ;
IN: sequences.product

