diff --git a/pkgs/racket-pkgs/racket-doc/syntax/scribblings/for-transform.scrbl b/pkgs/racket-pkgs/racket-doc/syntax/scribblings/for-transform.scrbl new file mode 100644 index 0000000000..8f01be8983 --- /dev/null +++ b/pkgs/racket-pkgs/racket-doc/syntax/scribblings/for-transform.scrbl @@ -0,0 +1,33 @@ +#lang scribble/manual +@(require (for-label racket/base + racket/sequence)) + +@title{@racket[for] Clause Transforms} + +@defmodule[syntax/for-transform]{The @racketmodname[syntax/for-transform] module +provides a helper function that gives access to the sequence transformers +defined by @racket[define-sequence-syntax]. This is what the @racket[for] forms +use and enables faster +@tech[#:doc '(lib "scribblings/reference/reference.scrbl")]{sequence} traversal +than what the sequence interface provides.} + +@defproc[(expand-for-clause [orig-stx syntax?] [clause syntax?]) syntax?]{ + +Expands a @racket[for] clause of the form @racket[[(x ...) seq-expr]], where +@racket[x] are identifiers, to: + +@racketblock[ +(([(outer-id ...) outer-expr] ...) + outer-check + ([loop-id loop-expr] ...) + pos-guard + ([(inner-id ...) inner-expr] ...) + pre-guard + post-guard + (loop-arg ...))] + +which can then be spliced into the appropriate iterations. See @racket[:do-in] +for more information. + +The first argument @racket[orig-stx] is used only for reporting syntax errors. +} diff --git a/pkgs/racket-pkgs/racket-doc/syntax/scribblings/syntax.scrbl b/pkgs/racket-pkgs/racket-doc/syntax/scribblings/syntax.scrbl index 21270a10e3..58507a80bf 100644 --- a/pkgs/racket-pkgs/racket-doc/syntax/scribblings/syntax.scrbl +++ b/pkgs/racket-pkgs/racket-doc/syntax/scribblings/syntax.scrbl @@ -19,6 +19,8 @@ @include-section["for-body.scrbl"] +@include-section["for-transform.scrbl"] + @include-section["srcloc.scrbl"] @include-section["quote.scrbl"] diff --git a/racket/collects/racket/HISTORY.txt b/racket/collects/racket/HISTORY.txt index 316bd17e33..1426de25ad 100644 --- a/racket/collects/racket/HISTORY.txt +++ b/racket/collects/racket/HISTORY.txt @@ -2,6 +2,7 @@ Version 5.90.0.9 Allow hash table chaperones and impersonators to Support efficient hash-clear and hash-clear! setup/collection-name: added +syntax/for-transform: added Version 5.90.0.6 Added path