Next: , Previous: , Up: scheme overview   [Index]


3.1.14 Libraries

Scheme code can be organized in components called libraries. Each library contains definitions and expressions. It can import definitions from other libraries and export definitions to other libraries.

The following library called ‘(hello)’ exports a definition called hello-world, and imports the base library and the simple I/O library. The hello-world export is a procedure that displays ‘Hello World’ on a separate line:

(library (hello)
  (export hello-world)
  (import (rnrs base)
          (rnrs io simple))
  (define (hello-world)
    (display "Hello World")
    (newline)))