10 The Prolog Library

The Prolog library comprises a number of packages that 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.

To load a library package Package, you will normally enter a query

     | ?- use_module(library(Package)).

A library package normally consists of one or more hidden (see ref-mod) modules. The following packages are provided:

aggregate (see lib-aggregate)
provides an aggregation operator for data-base-style queries.
assoc (see lib-assoc)
uses unbalanced binary trees trees to implement “association lists”, i.e. extendible finite mappings from terms to terms.
atts (see lib-atts)
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.
avl (see lib-avl)
uses AVL trees to implement “association lists”, i.e. extendible finite mappings from terms to terms.
bags (see lib-bags)
defines operations on bags, or multisets
bdb (see lib-bdb)
provides an interface to Berkeley DB, for storage and retrieval of terms on disk files with user-defined multiple indexing.
between (see lib-between)
provides some means of generating integers.
codesio (see lib-codesio)
defines I/O predicates that read from, or write to, a code-list.
file_systems (see lib-file_systems)
accesses files and directories.
heaps (see lib-heaps)
implements binary heaps, the main application of which are priority queues.
lists (see lib-lists)
provides basic operations on lists.
logarr (see lib-logarr)
provides an implementation of extendible arrays with logarithmic access time.
objects (see lib-objects)
provides a package for object-oriented programming, and can be regarded as a high-level alternative to library(structs).
ordsets (see lib-ordsets)
defines operations on sets represented as lists with the elements ordered in Prolog standard order.
process (see lib-process)
provides process creation primitives.
queues (see lib-queues)
defines operations on queues (FIFO stores of information).
random (see lib-random)
provides a random number generator.
rem (see lib-rem)
provides Rem's algorithm for maintaining equivalence classes.
samsort (see lib-samsort)
provides generic sorting.
sets (see lib-sets)
defines operations on sets represented as lists with the elements unordered.
sockets (see lib-sockets)
provides an interface to sockets.
structs (see lib-structs)
provides access to C data structures, and can be regarded as a low-level alternative to library(objects).
system (see lib-system)
provides access to operating system services.
terms (see lib-terms)
provides a number of operations on terms.
timeout (see lib-timeout)
Meta-call with limit on execution time.
trees (see lib-trees)
uses binary trees to represent non-extendible arrays with logarithmic access time. The functionality is very similar to that of library(logarr), but library(trees) is slightly more efficient if the array does not need to be extendible.
types (see lib-types)
Provides type checking.
ugraphs (see lib-ugraphs)
Provides an implementation of directed and undirected graphs with unlabeled edges.
varnumbers (see lib-varnumbers)
An inverse of numbervars/3.
wgraphs (see lib-wgraphs)
provides an implementation of directed and undirected graphs where each edge has an integral weight.
xml (see lib-xml)
provides an XML parser.
linda/client (see lib-linda)
linda/server (see lib-linda)
provides an implementation of the Linda concept for process communication.
chr (see lib-chr)
provides Constraint Handling Rules
clpfd (see lib-clpfd)
provides constraint solving over Finite (Integer) Domains
clpq (see lib-clpqr)
clpr (see lib-clpqr)
provides constraint solving over Q (Rationals) or R (Reals)
fdbg (see lib-fdbg)
provides a debugger for finite domain constraint programs
pillow (see lib-pillow)
The PiLLoW Web Programming Library,
tcltk (see lib-tcltk)
An interface to the Tcl/Tk language and toolkit.
gauge (see lib-gauge)
is a profiling tool for Prolog programs with a graphical interface based on tcltk.
prologbeans (see lib-prologbeans)
Access Prolog from Java.
comclient (see lib-comclient)
An interface to Microsoft COM automaton objects.

For the purpose of migrating code from release 3, the following deprecated library modules are also provided. For documentation, please see the release 3 documentation for the corresponding library module with the trailing `3' removed from its name:

arrays3
assoc3
lists3
queues3
random3
system3

Send feedback on this subject.