Please read what I said in the parent node.
That's not a proper list, so r5rs doesn't guarantee this will
work. It does work with some scheme implementations, but
MzScheme says
for-each: expects type <proper list> as 2nd argument, given: #0=(1 . #
+0#); other arguments were: #<procedure:STDIN::59>
if I type this code in it.
Update: let me quote from the r5rs.
Pairs are used primarily to represent lists. A list can be defined
recursively as either the empty list or a pair whose cdr is a list.
More precisely, the set of lists is defined as the smallest set X such
that
-
The empty list is in X.
-
If LIST is in X, then any pair whose cdr field contains LIST is
also in X.
and later
-
library procedure: map proc list1 list2 ...,
-
The LISTs must be lists, and PROC must be a procedure taking as
many arguments as there are lists and returning a single value.
If more than one LIST is given, then they must all be the same
length. `Map' applies PROC element-wise to the elements of the
LISTs and returns a list of the results, in order. The dynamic
order in which PROC is applied to the elements of the LISTs is
unspecified.
-
library procedure: for-each proc list1 list2 ...,
-
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.