{"size": 1464, "ext": "scrbl", "max_stars_repo_path": "pkgs/racket-doc/syntax/scribblings/apply-transformer.scrbl", "max_stars_repo_name": "lkh01/racket", "max_stars_repo_stars_event_min_datetime": "2018-07-05T21:18:24.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-04T14:48:37.000Z", "max_issues_repo_path": "pkgs/racket-doc/syntax/scribblings/apply-transformer.scrbl", "max_issues_repo_name": "lkh01/racket", "max_issues_repo_issues_event_min_datetime": "2017-05-10T07:33:20.000Z", "max_issues_repo_issues_event_max_datetime": "2018-07-19T15:49:46.000Z", "max_forks_repo_path": "pkgs/racket-doc/syntax/scribblings/apply-transformer.scrbl", "max_forks_repo_name": "lkh01/racket", "max_forks_repo_forks_event_min_datetime": "2016-04-25T11:47:57.000Z", "max_forks_repo_forks_event_max_datetime": "2017-05-09T14:52:48.000Z"}
{"max_stars_count": 4, "max_issues_count": 9, "max_forks_count": 3, "avg_line_length": 50.4827586207, "max_line_length": 101, "alphanum_fraction": 0.7096994536}
#lang scribble/doc
@(require "common.rkt" (for-label syntax/apply-transformer))

@title[#:tag "syntax/apply-transformer"]{Applying Macro Transformers}

@defmodule[syntax/apply-transformer]

@defproc[(local-apply-transformer [transformer (or/c (-> syntax? syntax?) set!-transformer?)]
                                  [stx syntax?]
                                  [context (or/c 'expression 'top-level 'module 'module-begin list?)]
                                  [intdef-ctxs (listof internal-definition-context?) '()])
         syntax?]{

Applies @racket[transformer] as a @tech[#:doc refman]{syntax transformer} to @racket[stx] in the
current expansion context. The result is similar to expanding a use of an
@tech[#:doc refman]{identifier} bound as a @tech[#:doc refman]{syntax transformer} bound to
@racket[transformer] with @racket[local-expand], except that expansion is guaranteed to stop after
applying a single macro transformation (assuming @racket[transformer] does not explicitly force
further recursive expansion).

Unlike simply applying @racket[transformer] to @racket[stx] directly, using
@racket[local-apply-transformer] introduces the appropriate @tech[#:doc refman]{use-site scope} and
@tech[#:doc refman]{macro-introduction scope} that would be added by the expander.

The @racket[context] and @racket[intdef-ctxs] arguments are treated the same way as the corresponding
arguments to @racket[local-expand].

@history[#:added "6.90.0.29"]}
