for-each -- r7rs Definition functor;
Procedure variants:
((for-each-procedure list |1...|) -> (undefined))
for-each-procedure;list;... -- at least one time;undefined;scheme:base -- (scheme base);scheme -- (scheme);(for-each proc list_1 list_2 ...)Domain: It is an error if
procdoes not accept as many arguments as there arelists.The arguments to
for-eachare like the arguments tomap, butfor-eachcallsprocfor its side effects rather than for its values. Unlikemap,for-eachis guaranteed to callprocon the elements of thelists in order from the first element(s) to the last, and the value returned byfor-eachis unspecified. If more than onelistis given and not all lists have the same length,for-eachterminates when the shortest list runs out. Thelists can be circular, but it is an error if all of them are circular.It is an error for
procto mutate any of the lists.(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)
The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.