Next: , Previous: Using Modules, Up: Using the Guile Module System


2.3.5.2 Writing new Modules

You can create new modules using the syntactic form define-module. All definitions following this form until the next define-module are placed into the new module.

One module is usually placed into one file, and that file is installed in a location where Guile can automatically find it. The following session shows a simple example.

     $ cat /usr/local/share/guile/foo/bar.scm
     
     (define-module (foo bar))
     (export frob)
     
     (define (frob x) (* 2 x))
     
     $ guile
     guile> (use-modules (foo bar))
     guile> (frob 12)
     24