import -- r7rs Definition syntax;
Syntax keywords:
import: value of type eval-environment-import;Syntax variants:
(_ import |...|)scheme:base -- (scheme base);scheme -- (scheme);(import <import-set> ...)An import declaration provides a way to import identifiers exported by a library. Each
<import-set>names a set of bindings from a library and possibly specifies local names for the imported bindings. It takes one of the following forms:
<library-name>(only <import-set> <identifier> ...)(except <import-set> <identifier> ...)(prefix <import-set> <identifier>)(rename <import-set> (<identifier_1> <identifier_2>) ...)In the first form, all of the identifiers in the named library's export clauses are imported with the same names (or the exported names if exported with
rename). The additional<import-set>forms modify this set as follows:
onlyproduces a subset of the given<import-set>including only the listed identifiers (after any renaming). It is an error if any of the listed identifiers are not found in the original set.
exceptproduces a subset of the given<import-set>, excluding the listed identifiers (after any renaming). It is an error if any of the listed identifiers are not found in the original set.
renamemodifies the given<import-set>, replacing each instance of<identifier_1>with<identifier_2>. It is an error if any of the listed<identifier_1>s are not found in the original set.
prefixautomatically renames all identifiers in the given<import-set>, prefixing each with the specified<identifier>.In a program or library declaration, it is an error to import the same identifier more than once with different bindings, or to redefine or mutate an imported binding with a definition or with
set!, or to refer to an identifier before it is imported. However, a REPL should permit these actions.
The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.