chickadee » scheme » for-each

(for-each proc list[1] list[2] ...)procedure

The arguments to for-each are like the arguments to map, but for-each calls proc for its side effects rather than for its values. Unlike map, for-each is guaranteed to call proc on the elements of the lists in order from the first element(s) to the last, and the value returned by for-each is unspecified.

(let ((v (make-vector 5)))
  (for-each (lambda (i)
              (vector-set! v i (* i i)))
            '(0 1 2 3 4))
  v)                                        ===>  #(0 1 4 9 16)

Like in SRFI-1, this procedure allows the arguments to be of unequal length; it terminates when the shortest list runs out. This is a CHICKEN extension to R5RS.