Next: using libraries filenames, Up: using libraries [Index]
A library consists of a “file” (some assemblage of text) that contains a library form, which might look like this:
(library (sample) (export cube) (import (rnrs)) (define cube (lambda (x) (* x x x))))
notice the import
clause. No library is imported by default;
therefore, if we want to write some general purpose code, we have to
import at least one library that exports enough features to compose a
programming language; there multiple libraries of this kind, for example
(rnrs)
and (vicare)
.
We can import (sample)
into another library, a script, or a
Vicare top–level session:
> (import (sample)) > (cube 3) 27
Library names are lists, thus allowing the writer of one or more
libraries to group related libraries together. For example,
Vicare installs a whole hierarchy of libraries under
(vicare language-extensions)
:
(vicare language-extensions amb) (vicare language-extensions conditions-and-restarts)) ...
Vicare’s own Scheme libraries are under the hierarchies:
(vicare ---)
, (srfi ---)
and (nausicaa ---)
.
Vicare’s boot image and distributed libraries are installed in the directory:
$(libdir)/vicare-scheme
on 32-bit GNU+Linux systems:
/usr/local/lib/vicare-scheme
on 64-bit GNU+Linux systems:
/usr/local/lib64/vicare-scheme
for example the library (vicare ffi)
on 32-bit GNU+Linux
systems is installed as:
/usr/local/lib/vicare-scheme/vicare/ffi.fasl