R7RS libraries are defined by
In R7RS view,
define-library form itself does not belong
to a Scheme code—it exists outside of the Scheme world.
It defines the boundary of
R7RS Scheme; inside
define-library there is R7RS world,
but outside, it’s not a business of R7RS.
For example, you can’t generate
define-library by a macro, within R7RS specification.
In Gauche, we implement R7RS world inside Gauche world;
define-library itself is interpreted in the Gauche world.
define-library is a Gauche macro.
However, if you’re writing portable R7RS code, you should forget
define-library is implemented, and do not put anything
[R7RS] Defines a library library-name, which is a list of symbols or base-10 integer:
<library-name> : (<identifier-or-base-10-integer> <identifier-or-base-10-integer> ...)
Library declarations library-decl
can be export declarations, import declarations,
begin-list of Scheme code,
include forms, or
<library-decl> : (export <export-spec> …) | <import declaration> | (begin <command-or-definition> …) | (include <string> <string2> …) | (include-ci <string> <string2> …) | (include-library-declarations <string> <string2> …) | (cond-expand <cond-expand-clause> <cond-expand-clause2> …) | (cond-expand <cond-expand-clause> <cond-expand-clause2> … (else <library-decl> …))
export declaration is the same Gauche’s
form; see Using modules.
import declaration is R7RS’s
described in Three forms of import.
are the same as Gauche’s; see Inclusions.
Note that Gauche allows any code to be included—the content of
the named file is simply wrapped with
substituted with these forms—but in R7RS definition,
what you include must contain only Scheme code
(not one of the library declarations or
include-library-declarations declaration works like
but the content of the read file is interpreted
as library declarations instead of Scheme code.
cond-expand declaration is also the same as Gauche’s;
see Feature conditional. When used directly below
define-library, it must expands to one of the