A The SWI-Prolog library

This chapter documents the SWI-Prolog library. As SWI-Prolog provides auto-loading, there is little difference between library predicates and built-in predicates. Part of the library is therefore documented in the rest of the manual. Library predicates differ from built-in predicates in the following ways:

The documentation of the library has just started. Material from the standard packages should be moved here, some material from other parts of the manual should be moved too and various libraries are not documented at all.


Section Index


A.1 library(aggregate): Aggregation operators on backtrackable predicates
A.2 library(ansi_term): Print decorated text to ANSI consoles
A.3 library(apply): Apply predicates on a list
A.4 library(assoc): Association lists
A.4.1 Introduction
A.4.2 Creating association lists
A.4.3 Querying association lists
A.4.4 Modifying association lists
A.4.5 Conversion predicates
A.4.6 Reasoning about association lists and their elements
A.5 library(broadcast): Broadcast and receive event notifications
A.6 library(charsio): I/O on Lists of Character Codes
A.7 library(check): Consistency checking
A.8 library(clpb): CLP(B): Constraint Logic Programming over Boolean Variables
A.8.1 Introduction
A.8.2 Boolean expressions
A.8.3 Interface predicates
A.8.4 Examples
A.8.5 Obtaining BDDs
A.8.6 Enabling monotonic CLP(B)
A.8.7 Example: Pigeons
A.8.8 Example: Boolean circuit
A.8.9 Acknowledgments
A.8.10 CLP(B) predicate index
A.9 library(clpfd): CLP(FD): Constraint Logic Programming over Finite Domains
A.9.1 Introduction
A.9.2 Arithmetic constraints
A.9.3 Declarative integer arithmetic
A.9.4 Example: Factorial relation
A.9.5 Combinatorial constraints
A.9.6 Domains
A.9.7 Example: Sudoku
A.9.8 Residual goals
A.9.9 Core relations and search
A.9.10 Example: Eight queens puzzle
A.9.11 Optimisation
A.9.12 Reification
A.9.13 Enabling monotonic CLP(FD)
A.9.14 Custom constraints
A.9.15 Applications
A.9.16 Acknowledgments
A.9.17 CLP(FD) predicate index
A.9.17.1 Arithmetic constraints
A.9.17.2 Membership constraints
A.9.17.3 Enumeration predicates
A.9.17.4 Global constraints
A.9.17.5 Reification predicates
A.9.17.6 Reflection predicates
A.9.17.7 FD set predicates
A.9.17.8 FD miscellaneous predicates
A.9.18 Closing and opening words about CLP(FD)
A.10 library(clpqr): Constraint Logic Programming over Rationals and Reals
A.10.1 Solver predicates
A.10.2 Syntax of the predicate arguments
A.10.3 Use of unification
A.10.4 Non-linear constraints
A.10.5 Status and known problems
A.11 library(csv): Process CSV (Comma-Separated Values) data
A.12 library(dcg/basics): Various general DCG utilities
A.13 library(dcg/high_order): High order grammar operations
A.14 library(debug): Print debug messages and test assertions
A.15 library(dicts): Dict utilities
A.16 library(error): Error generating support
A.17 library(fastrw): Fast reading and writing of terms
A.18 library(gensym): Generate unique symbols
A.19 library(heaps): heaps/priority queues
A.20 library(increval): Incremental dynamic predicate modification
A.21 library(intercept): Intercept and signal interface
A.22 library(iostream): Utilities to deal with streams
A.23 library(listing): List programs and pretty print clauses
A.24 library(lists): List Manipulation
A.25 library(main): Provide entry point for scripts
A.26 library(nb_set): Non-backtrackable set
A.27 library(www_browser): Open a URL in the users browser
A.28 library(occurs): Finding and counting sub-terms
A.29 library(option): Option list processing
A.30 library(optparse): command line parsing
A.30.1 Notes and tips
A.31 library(ordsets): Ordered set manipulation
A.32 library(pairs): Operations on key-value lists
A.33 library(persistency): Provide persistent dynamic predicates
A.34 library(pio): Pure I/O
A.34.1 library(pure_input): Pure Input from files and streams
A.35 library(portray_text): Portray text
A.36 library(predicate_options): Declare option-processing of predicates
A.36.1 The strength and weakness of predicate options
A.36.2 Options as arguments or environment?
A.36.3 Improving on the current situation
A.36.3.1 Options as types
A.36.3.2 Reflective access to options
A.37 library(prolog_debug): User level debugging tools
A.38 library(prolog_jiti): Just In Time Indexing (JITI) utilities
A.39 library(prolog_pack): A package manager for Prolog
A.40 library(prolog_xref): Prolog cross-referencer data collection
A.41 library(quasi_quotations): Define Quasi Quotation syntax
A.42 library(random): Random numbers
A.43 library(rbtrees): Red black trees
A.44 library(readutil): Read utilities
A.45 library(record): Access named fields in a term
A.46 library(registry): Manipulating the Windows registry
A.47 library(settings): Setting management
A.48 library(statistics): Get information about resource usage
A.49 library(strings): String utilities
A.50 library(simplex): Solve linear programming problems
A.50.1 Introduction
A.50.2 Delayed column generation
A.50.3 Solving LPs with special structure
A.50.4 Examples
A.50.4.1 Example 1
A.50.4.2 Example 2
A.50.4.3 Example 3
A.51 library(solution_sequences): Modify solution sequences
A.52 library(tables): XSB interface to tables
A.53 library(terms): Term manipulation
A.54 library(thread): High level thread primitives
A.55 library(thread_pool): Resource bounded thread management
A.56 library(ugraphs): Graph manipulation library
A.57 library(url): Analysing and constructing URL
A.58 library(varnumbers): Utilities for numbered terms
A.59 library(yall): Lambda expressions