5 Libraries and Collections

An R6 RS library name is sequence of symbols, optionally followed by a version as a sequence of exact, non-negative integers. Roughly, such a name is converted to a Racket module pathname (see Module Paths) by concatenating the symbols with a / separator, and then appending the version integers each with a preceding -. As a special case, when an R6RS path contains a single symbol (optionally followed by a version), a main symbol is effectively inserted after the initial symbol. See below for further encoding considerations.

When an R6RS library or top-level program refers to another library, it can supply version constraints rather than naming a specific version. Version constraints are always resolved at compile time by searching the set of installed files.

In addition, when an R6RS library path is converted, a file extension is selected at compile time based on installed files. The search order for file extensions is ".mzscheme.ss", ".mzscheme.sls", ".ss", ".sls", and ".rkt". When resolving version constraints, these extensions are all tried when looking for matches.

To ensure that all R6RS library names can be converted to a unique and distinct library module path, the following conversions are applied to each symbol before concatenating them:

Examples (assuming a typical Racket installation):

(rnrs io simple (6))  means  (lib "rnrs/io/simple-6.rkt")
(rnrs)                means  (lib "rnrs/main-6.rkt")
(rnrs main)           means  (lib "rnrs/main_.rkt")
(rnrs (6))            means  (lib "rnrs/main-6.rkt")
(racket base)         means  (lib "racket/base.rkt")
(achtung!)            means  (lib "achtung%21/main.rkt")
(funco new-λ)         means  (lib "funco/new-%ce%bb.rkt")