The space of module names is distinct from the space of normal Scheme definitions. Indeed, since modules typically reside in files, the space of module names is explicitly tied to the filesystem at run time. For example, if the file "/home/molly/cake.ss" contains
; draws a cake with n candles
(define (print-cake n)
then it can be used as the source of a module whose full name is based on the path "/home/molly/cake.ss". The provide line exports the definition print-cake so that it can be used outside the module.
Instead of using its full path, a module is more likely to be referenced by a relative path. For example, a file "/home/molly/random-cake.ss" could use the "cake.ss" module like this:
(print-cake (random 30))
The relative reference "cake.ss" in the import (require "cake.ss") works because the "cake.ss" module source is in the same directory as the "random-cake.ss" file. (Unix-style relative paths are used for relative module references on all platforms, much like relative URLs.)
Library modules that are distributed with PLT Scheme are usually referenced through an unquoted, suffixless path. The path is relative to the library installation directory, which contains directories for individual library collections. The module below refers to the "date.ss" library that is part of the "scheme" collection.
(printf "Today is ~s\n"
In addition to the main collection directory, which contains all collections that are part of the installation, collections can also be installed in a user-specific location. Finally, additional collection directories can be specified n configuration files or through the PLTCOLLECTS search path. Try running the following program to find out where your collections are:
(find-collects-dir) ; main collection directory
(find-user-collects-dir) ; user-specific collection directory
(get-collects-search-dirs) ; complete search path
We discuss more forms of module reference later in Module Paths.