7.8
7 Parsing for Bodies
(require syntax/for-body) | package: base |
The syntax/for-body module
provides a helper function for for-like syntactic forms that
wrap the body of the form while expanding to another for-like
form, and the wrapper should apply only after the last
#:break or #:final clause in the body.
procedure
(split-for-body stx body-stxes) → syntax?
stx : syntax? body-stxes : syntax?
The body-stxes argument must have the form
(pre-body ... post-body ...), and it is rewritten into
((pre-body ...) (post-body ...)) such that
(post-body ...) is as large as possible without containing a
#:break or #:final clause.
The stx argument is used only for reporting syntax errors.
Use split-for-body instead of assuming that the last form in a for-like form’s body can be wrapped separately. In particular, the last form might contain definitions that need to be spliced in the same definition context as earlier forms to create mutually-recursive definitions.