chickadee » srfi-179 » array-for-each

array-for-each f array #!rest arraysprocedure

If array, (car arrays), ... all have the same domain and f is an appropriate procedure, then array-for-each calls

(interval-for-each
 (lambda multi-index
   (apply f
          (map (lambda (g)
                 (apply g multi-index))
               (map array-getter
                    (cons array
                          arrays)))))
 (array-domain array))

In particular, array-for-each always walks the indices of the arrays in lexicographical order.

It is expected that array-map and array-for-each will specialize the construction of

(lambda multi-index
  (apply f
         (map (lambda (g)
                (apply g multi-index))
              (map array-getter
                   (cons array
                         arrays)))))

It is an error to call array-for-each if its arguments do not satisfy these conditions.