document binding structure of for/fold

The binding structure is not natural, but changing the binding rules
would risk breaking existing code.

Closes #1659
This commit is contained in:
Matthew Flatt 2017-04-29 11:08:42 -07:00
parent 13443dec92
commit bb2f1998f1

View File

@ -322,6 +322,12 @@ those values become the current accumulator values. When iteration
terminates, the results of the @racket[for/fold] expression are the
accumulator values.
An @racket[accum-id] and a binding from a @racket[for-clause] can be
the same identifier. In that case, the @racket[accum-id] binding
shadows the one in a @racket[for-clause] within the
@racket[body-or-break] and @racket[body] forms (even though,
syntactically, a @racket[for-clause] is closer to to the body).
@examples[
(for/fold ([sum 0]
[rev-roots null])