On this page:
splicing-let-syntax
splicing-letrec-syntax
splicing-let-syntaxes
splicing-letrec-syntaxes
splicing-syntax-parameterize
Version: 4.1.5

11.6 Local Binding with Splicing Body

 (require scheme/splicing)

The bindings documented in this section are provided by the scheme/splicing library, not scheme/base or scheme.

splicing-let-syntax
splicing-letrec-syntax
splicing-let-syntaxes
splicing-letrec-syntaxes

Like let-syntax, letrec-syntax, let-syntaxes, and letrec-syntaxes, except that in a definition context, the body forms are spliced into the enclosing definition context (in the same as as for begin).

Examples:

  > (splicing-let-syntax ([one (lambda (stx) #'1)])
      (define o one))
  > o

  1

  > one

  reference to undefined identifier: one

splicing-syntax-parameterize

Like syntax-parameterize, except that in a definition context, the body forms are spliced into the enclosing definition context (in the same as as for begin), as long as the body forms are valid in an internal-definition context. In particular, require and provide forms cannot appear in the body of splicing-syntax-parameterize, even if splicing-syntax-parameterize is used in a module body.

Examples:

  > (define-syntax-parameter place (lambda (stx) #'"Kansas"))
  > (define-syntax-rule (where) `(at ,(place)))
  > (where)

  (at "Kansas")

  > (splicing-syntax-parameterize ([place (lambda (stx) #'"Oz")])
      (define here (where)))
  > here

  (at "Oz")