add syntax/for-transform
- provides expand-clause (as expand-for-clause) from racket/private/for.rkt
This commit is contained in:
parent
905033e3f8
commit
a84cf6b61d
|
@ -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.
|
||||
}
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
@include-section["for-body.scrbl"]
|
||||
|
||||
@include-section["for-transform.scrbl"]
|
||||
|
||||
@include-section["srcloc.scrbl"]
|
||||
|
||||
@include-section["quote.scrbl"]
|
||||
|
|
|
@ -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<?, symbol<?
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
for/fold/derived for*/fold/derived
|
||||
(for-syntax split-for-body)
|
||||
(for-syntax (rename expand-clause expand-for-clause))
|
||||
|
||||
(rename *in-range in-range)
|
||||
(rename *in-naturals in-naturals)
|
||||
|
|
4
racket/collects/syntax/for-transform.rkt
Normal file
4
racket/collects/syntax/for-transform.rkt
Normal file
|
@ -0,0 +1,4 @@
|
|||
#lang racket/base
|
||||
|
||||
(require (for-template (only-in racket/private/for expand-for-clause)))
|
||||
(provide expand-for-clause)
|
Loading…
Reference in New Issue
Block a user