On this page:

21 Require utilities

 (require (planet untyped/unlib/require))

Utilities for use with require statements.

(directory-in path)

Expands to (combine-in (file "foo.ss") ...) for all Scheme source files (".ss" and ".scm" extensions) in path. path must be a string literal.

Known issues: This form is sensitive to the value of current-directory and may not be useful in all cases. Future improvements will force path to be relative to the directory containing the current module.

(define-library-aliases id source kw ...)
(define-library-aliases (in-id out-id) source kw ...)
source = (file dir-spec)
  | (planet planet-spec)
dir-spec = string
planet-spec = id
kw = #:provide

Defines require and provide shortcuts for a code library. Similar in function to Ryan Culpepper’s {Require.plt}.

The two-identifier form binds in-id and out-id to require- and provide-transformers that require and provide modules from the specified library. The single-identifier form expands to the two-identifier form by appending -in and -out to id. If the #:provide keyword is specified, provide statements are automatically injected for in-id and out-id.

dir-spec must be a string literal, which is expanded to a path using:

  (path->complete-path (expand-user-path (build-path dir-spec)))

This means platform-specific shorthands such as "~" are valid in directory names. planet-spec must be a shorthand PLaneT package name. Module filenames must end with ".ss".


  ; Define (and provide) a-in and a-out:
  (define-library-aliases a (file "foo") #:provide)
  (require (a-in)      ; require a/main.ss
           (a-in b c)  ; require a/b.ss and a/c.ss
           (a-in d/e)) ; require a/d/e.ss
  ; Define (but do not provide) x-in and x-out:
  (define-library-aliases x (planet untyped/bar:1:2))
  (require (x-in a))  ; require untyped/bar:1:2/a.ss
  (provide (x-out a)) ; provide everything from untyped/bar:1:2/a.ss