chickadee » scheme » base » import

(import IMPORT-SET ...)syntax

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:

  • only produces 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.
  • except produces 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.
  • rename modifies 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.
  • prefix automatically renames all identifiers in the given <import set>, prefixing each with the specified <identifier>.