Next: , Previous: , Up: Top   [Contents][Index]

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.

As opposed to built-in predicates, predicates exported by library modules generally do not check their arguments, although some do to a lesser or greater extent. Input arguments that are lists are usually supposed to be proper lists, i.e., not end with an unbound variable. Input arguments that are trees are usually not supposed to have uninstantiated leaves, and so on.

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.

chr (see lib-chr)

provides Constraint Handling Rules

clpb (see lib-clpb)   since release 4.0.7,unsupported

provides constraint solving over Booleans

clpfd (see lib-clpfd)

provides constraint solving over Finite (Integer) Domains

clpq (see lib-clpqr)   unsupported
clpr (see lib-clpqr)   unsupported

provides constraint solving over Q (Rationals) or R (Reals)

codesio (see lib-codesio)

defines I/O predicates that read from, or write to, a code list.

csv (see lib-csv)

defines I/O predicates that read from, or write to, comma-separated values (CSV) files and strings.

comclient (see lib-comclient)

An interface to Microsoft COM automaton objects.

fdbg (see lib-fdbg)

provides a debugger for finite domain constraint programs

file_systems (see lib-file_systems)

accesses files and directories.

gauge (see lib-gauge)

A profiling tool for Prolog programs with a graphical interface based on tcltk.

heaps (see lib-heaps)

implements binary heaps, the main application of which are priority queues.

is_directives (see lib-is_directives)

Access information about predicates that have been declared with is/2 directives.

jasper (see lib-jasper)   since release 4.0.3

Access Prolog from Java.

json (see lib-json)   since release 4.5.0

defines I/O predicates that read and write using the JSON serialization format. It also comes with several examples for using JSON to communicate between SICStus and other programming languages.

linda/client (see lib-linda)
linda/server (see lib-linda)

provides an implementation of the Linda concept for process communication.

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

odbc (see lib-odbc)   since release 4.1

provides an interface to an ODBC database driver.

ordsets (see lib-ordsets)

defines operations on sets represented as lists with the elements ordered in Prolog standard order.

pillow (see lib-pillow)   unsupported

The PiLLoW Web Programming Library,

plunit (see lib-plunit)   since release 4.1.3

A Prolog unit-test framework.

process (see lib-process)

provides process creation primitives.

prologbeans (see lib-prologbeans)

Access Prolog from Java and .NET.

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 stable sorting and merging.

sets (see lib-sets)

defines operations on sets represented as lists with the elements unordered.

sockets (see lib-sockets)

provides an interface to sockets.

statistics (see lib-statistics)   since release 4.3.4

provides commonly used sample and population statistics functions.

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.

tcltk (see lib-tcltk)

An interface to the Tcl/Tk language and toolkit.

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.

zinc (see lib-zinc)   since release 4.0.5

provides an interpreter for FlatZinc programs

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:


Send feedback on this subject.