15 The Prolog Library

% TODO: Pillow, PrologBeans, Spaceout, XML. % Manual order.

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. The following packages are provided:

arrays (see Arrays)
provides an implementation of extendible arrays with logarithmic access time.
assoc (see Assoc)
uses AVL trees to implement “association lists”, i.e. extendible finite mappings from terms to terms.
atts (see Attributes)
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.
heaps (see Heaps)
implements binary heaps, the main application of which are priority queues.
lists (see Lists)
provides basic operations on lists.
terms (see Term Utilities)
provides a number of operations on terms.
ordsets (see Ordsets)
defines operations on sets represented as lists with the elements ordered in Prolog standard order.
queues (see Queues)
defines operations on queues (FIFO stores of information).
random (see Random)
provides a random number generator.
system (see System Utilities)
provides access to operating system services.
trees (see Trees)
uses binary trees to represent non-extendible 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 extendible.
ugraphs (see UGraphs)
Provides an implementation of directed and undirected graphs with unlabeled edges.
wgraphs (see WGraphs)
provides an implementation of directed and undirected graphs where each edge has an integral weight.
sockets (see Sockets)
provides an interface to system calls for manipulating sockets.
linda/client
linda/server (see Linda Library)
provides an implementation of the Linda concept for process communication.
bdb (see BDB)
provides an interface to Berkeley DB, for storage and retrieval of terms on disk files with user-defined multiple indexing.
clpb (see CLPB)
provides constraint solving over Booleans.
clpq
clpr (see CLPQR)
provides constraint solving over Q (Rationals) or R (Reals).
clpfd (see CLPFD)
provides constraint solving over Finite (Integer) Domains
chr (see CHR)
provides Constraint Handling Rules
fdbg (see FDBG)
provides a debugger for finite domain constraint programs
objects (see Obj Intro)
provides the combination of the logic programming and the object-oriented programming paradigms.
pillow (see PiLLoW)
The PiLLoW Web Programming Library,
xml (see XML)
Parsing and generating XML.
tcltk (see Tcl/Tk)
An interface to the Tcl/Tk language and toolkit.
gauge (see Gauge)
is a profiling tool for Prolog programs with a graphical interface based on tcltk.
charsio (see Chars I/O)
defines I/O predicates that read from, or write to, a code-list.
jasper (see Jasper)
Access Java from Prolog.
prologbeans (see PrologBeans)
Access Prolog from Java.
comclient (see COM Client)
An interface to Microsoft COM automaton objects.
vbsp (see Visual Basic)
Access Prolog from Visual Basic.
flinkage (see Runtime Utilities)
is a tool for generating glue code for the Foreign Language Interface when building statically linked runtime systems or development systems. No longer supported but provided for porting really old code.
spaceout (see Spaceout)
Meta-call with limit on memory use.
timeout (see Timeout)
Meta-call with limit on execution time.
wcx_example
provides a sample implementation of a Wide Character Extension (WCX) box.

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 modules.

An alternative way of loading from the library is using the built-in predicate require/1 (see Read In). 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)).
make_index:make_library_index(+LibraryDirectory)
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.