12.1.3 Library Modules

There is no consensus for a core library, portable across Prolog systems, let alone a standard for such a library. Since release 3, SICS has acquired Quintus Prolog, which has a rather rich library. For release 4, we have decided to make this asset be available to the SICStus community by providing a library that is a merger of the previous SICStus and Quintus libraries, which already overlap significantly.

The User's Manual documents the library of release 4. For the purposes of aiding code transition to release 4, the following is a list of the release 3 library modules, and their fate in release 4. See also Guide to Porting Code from Release 3.

atts
comclient
fdbg
gauge
heaps
linda/client
linda/server
pillow
prologbeans
tcltk
timeout
trees
wgraphs
xml
As in release 3.
arrays
The native release 4 counterpart is called library(logarr). Also available is a deprecated compatibility module library(arrays3).
assoc
The native release 4 counterpart is called library(avl), reflecting the abstract data type, AVL trees, and with a modified, richer API. Also available is a deprecated compatibility module library(assoc3).
bdb
As in release 3, but uses the default Berkeley DB hash function, so all of the standard Berkeley DB utilites should now work.
charsio
Called library(codesio) in release 4. Likewise, the syllable `chars' has been renamed to `codes' in predicate names.
clpb
clpq
clpr
As in release 3, unsupported.
clpfd
As in release 3, plus the following additions and changes:
automaton/8
is a new constraint capturing any constraint whose checker of ground instances can be expressed as a finite automaton.
minimum/2
maximum/2
are new constraints, constraining a value to be the minimum (maximum) of a list of values.
nvalue/2
is a new constraint, constraining the number of distinct values taken by a list of values.
cumulative/[1,2]
provides a unified interface, subsuming serialized/[2,3] and cumulative/[4,5].
table/[2,3]
defines an n-ary constraint by extension, subsuming relation/3.
all_different/[1,2]
all_distinct/[1,2]
Arguments can have unbounded domains.
scalar_product/[4,5]
can optionally be told to maintain arc-consistency. This functionality subsumes knapsack/3.
global_cardinality/[2,3]
can optionally be told to use a simple algorithm. This functionality subsumes count/4.
fd_copy_term/3
is gone. Subsumed by built-in copy_term/3.

jasper
The Jasper module is available in the current release. An alternative for Java users is PrologBeans. The latter is the recommended method for interfacing Java with SICStus. Jasper should only be used when PrologBeans is insufficient.
lists
The native release 4 counterpart has a modified, richer API. Also available is a deprecated compatibility module library(lists3).
ordsets
As in release 3, plus several new predicates.
queues
The native release 4 counterpart has a modified, richer API. Also available is a deprecated compatibility module library(queues3).
random
The native release 4 counterpart has a modified, richer API. Also available is a deprecated compatibility module library(random3). Please note: The random number generator state is slightly different from the one in release 3.
sockets
The new predicate socket_client_open/3 subsumes socket/2 and socket_connect/3.

socket_server_open/[2,3] subsumes socket/2, socket_bind/2 and socket_listen/2.

socket_select/7 can wait for any kind of stream, not just socket streams. socket_select/7 waits until one unit (character for text streams, byte for binary streams) can be transferred.

socket_select/7 can wait for streams ready to write.

socket_select/7 does not create streams, you need to explicitly use socket_server_accept/4.

Socket streams are binary by default.

Blocking socket operations can be interrupted on both UNIX and Windows.

library(sockets) should work with IPv6 (in addition to IPv4 and AF_UNIX).

system
Operations on files and directories have been moved to its own module, library(file_systems). Process primitives have been redesigned and moved to a new module, library(process). The predicates for creating temporary files, mktemp/2 and tmpnam/1, have been removed. They used C library functionality that is broken by design and insecure. Instead, to create and open a temporary file use something like open(temp('foo'), write, S, [if_exists(generate_unique_name)]), possibly together with stream_property(S, file_name(Path)) if you need to know the path to the generated file name.

The (little) remaining functionality is largely as in release 3. Also available is a deprecated compatibility module library(system3).

terms
As in release 3, plus several new predicates. term_hash/2 is not guaranteed to compute the same hash values as in release 3.
ugraphs
As in release 3, plus a couple of deletions.
objects
Replaced by the Quintus Prolog flavor of library(objects).
chr
A reimplementation of library(chr), based on the Leuven implementation.
flinkage
spaceout
Not present in release 4.
vbsp
Not available in the current release. Visual Basic .NET and other .NET languages can use PrologBeans .NET.

The following is a list of library modules that are new in release 4.

aggregate
provides an aggregation operator for data-base-style queries.
assoc
uses unbalanced binary trees to implement “association lists”, i.e. extendible finite mappings from terms to terms.
bags
defines operations on bags, or multisets
between
provides some means of generating integers.
file_systems
accesses files and directories.
objects
provides a package for object-oriented programming, and can be regarded as a high-level alternative to library(structs).
plunit
Unit test harness.
process
Creating, killing, releasing, and waiting on processes.
rem
provides Rem's algorithm for maintaining equivalence classes.
samsort
provides generic sorting.
sets
defines operations on sets represented as lists with the elements unordered.
structs
provides access to C data structures, and can be regarded as a low-level alternative to library(objects).
types
Provides type checking.
varnumbers
An inverse of numbervars/3.

Send feedback on this subject.