{"size": 2645, "ext": "scrbl", "max_stars_repo_path": "pkgs/racket-doc/scribblings/reference/include.scrbl", "max_stars_repo_name": "lkh01/racket", "max_stars_repo_stars_event_min_datetime": "2018-07-29T04:13:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-14T16:11:17.000Z", "max_issues_repo_path": "pkgs/racket-doc/scribblings/reference/include.scrbl", "max_issues_repo_name": "lkh01/racket", "max_issues_repo_issues_event_min_datetime": "2017-08-25T20:26:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:48:40.000Z", "max_forks_repo_path": "pkgs/racket-doc/scribblings/reference/include.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": 10, "max_issues_count": 15, "max_forks_count": 3, "avg_line_length": 40.0757575758, "max_line_length": 79, "alphanum_fraction": 0.7489603025}
#lang scribble/doc
@(require "mz.rkt")

@title[#:tag "include"]{File Inclusion}

@note-lib[racket/include]

@defform/subs[#:literals (file lib)
              (include path-spec)
              ([path-spec string
                          (file string)
                          (lib string ...+)])]{

Inlines the syntax in the file designated by @racket[path-spec] in
place of the @racket[include] expression.

A @racket[path-spec] resembles a subset of the @racket[_mod-path]
forms for @racket[require], but it specifies a file whose content need
not be a module. That is, @racket[string] refers to a file using a
platform-independent relative path, @racket[(file string)] refers to a
file using platform-specific notation, and @racket[(lib string ...)]
refers to a file within a collection.

If @racket[path-spec] specifies a relative path, the path is resolved
relative to the source for the @racket[include] expression, if that
source is a complete path string. If the source is not a complete path
string, then @racket[path-spec] is resolved relative to
@racket[(current-load-relative-directory)] if it is not @racket[#f],
or relative to @racket[(current-directory)] otherwise.

The included syntax is given the lexical context of the
@racket[include] expression, while the included syntax's source
location refers to its actual source.}


@defform[(include-at/relative-to context source path-spec)]{

Like @racket[include], except that the lexical context of
@racket[context] is used for the included syntax, and a relative
@racket[path-spec] is resolved with respect to the source of
@racket[source]. The @racket[context] and @racket[source] elements are
otherwise discarded by expansion.}


@defform[(include/reader path-spec reader-expr)]{

Like @racket[include], except that the procedure produced by the
expression @racket[reader-expr] is used to read the included file,
instead of @racket[read-syntax].

The @racket[reader-expr] is evaluated at expansion time in the
@tech{transformer environment}. Since it serves as a replacement for
@racket[read-syntax], the expression's value should be a procedure
that consumes two inputs---a string representing the source and an
input port---and produces a syntax object or @racket[eof]. The
procedure will be called repeatedly until it produces @racket[eof].

The syntax objects returned by the procedure should have source
location information, but usually no lexical context; any lexical
context in the syntax objects will be ignored.}


@defform[(include-at/relative-to/reader context source path-spec reader-expr)]{

Combines @racket[include-at/relative-to] and @racket[include/reader].}
