Go to the previous, next section.
The Prolog library comprises a number of packages which are thought to
be useful in a number of applications. Note that the predicates in the
Prolog library are not built-in predicates. One has to explicitly load
each package to get access to its predicates. The following packages
are provided:
- @
- provides an implementation of extendable arrays with logarithmic access
time.
- @
- uses AVL trees to implement "association lists", i.e. extendable
finite mappings from terms to terms.
- @
- provides a means of associating with variables arbitrary attributes,
i.e. named properties that can be used as storage locations as well as
hooks into Prolog's unification.
- @
- implements binary heaps, the main application of which are priority queues.
- @
- provides basic operations on lists.
- @
- provides a number of operations on terms.
- @
- defines operations on sets represented as lists with the elements ordered
in Prolog standard order.
- @
- defines operations on queues (FIFO stores of information).
- @
- provides a random number generator.
- @
- provides access to operating system services.
- @
- uses binary trees to represent non-extendable arrays with logarithmic
access time. The functionality is very similar to that of
library(arrays)
, but library(trees)
is slightly more
efficient if the array does not need to be extendable.
- @
- provides an implementation of directed and undirected graphs with
unlabelled edges.
- @
- provides an implementation of directed and undirected graphs where
each edge has an integral weight.
- @
- provides an interface to system calls for manipulating sockets.
- @
- @
- provides an implementation of the Linda concept for process communication.
- @
- provides storage and retrieval of terms on disk files with user-defined
multiple indexing.
- @
- provides constraint solving over Booleans.
- @
- @
- provides constraint solving over Q (Rationals) or R (Reals).
- @
- provides the combination of the logic programming and the
object-oriented programming paradigms.
- @
- is a specification tool that is based on
Generalized Horn Clause Language, a generalization of Prolog.
- @
- An interface to the Tcl/Tk language and toolkit.
- @
- is a profiling tool for Prolog programs with a graphical interface based
on
tcltk
.
- @
- defines IO predicates that read from, or write to, a list of character codes.
- @
- is a utility program for generating glue code for the Foreign Language
Interface when building Runtime Systems or statically linked Development
Systems.
- @
- provides a way of running goals with an execution time limit.
- @
- provides a cross reference producer for debugging and program analysis.
To load a library package Package, you will normally enter a query
| ?- use_module(library(Package)).
Library packages may be compiled and consulted as well as loaded.
An alternative way of loading from the library is using the built-in
predicate require/1
(see section Reading-in Programs). The index file
`INDEX.pl' needed by require/1
can be created by the
make_index
program. This program is loaded as:
| ?- use_module(library(mkindex)).
- @
-
Creates a file `INDEX.pl' in LibraryDirectory. All
`*.pl' files in the directory and all its subdirectories are
scanned for
module/2
declarations. From these declarations, the
exported predicates are entered into the index.
Go to the previous, next section.