SICStus Prolog User's Manual
by the Programming Systems Group, , Swedish Institute of Computer Science, PO Box 1263, S-164 28 Kista, Sweden, , Release 3 #0, June 1995
Swedish Institute of Computer Science
sicstus-request@sics.se
}
Introduction
Acknowledgments
Notational Conventions
Keyboard Characters
Mode Spec
Predicate Spec
Development and Runtime Systems
Function Prototypes
ISO Compliance
Release Notes
How to Run Prolog
Getting Started
Reading in Programs
Inserting Clauses at the Terminal
Directives: Queries and Commands
Queries
Commands
Syntax Errors
Undefined Predicates
Program Execution And Interruption
Exiting From The Top-Level
Nested Executions--Break and Abort
Saving and Restoring Program States
Emacs Interface
Customizing Emacs
Available Commands
Mode Line
The Prolog Language
Syntax, Terminology and Informal Semantics
Terms
Integers
Floats
Atoms
Variables
Compound Terms
Programs
Declarative Semantics
Procedural Semantics
Occurs-Check
The Cut Symbol
Operators
Syntax Restrictions
Comments
Running Prolog in Parallel
Introduction
Running a Parallel Example
Main Issues of Parallel Execution
The Muse Model
Scheduling
Cut, Side Effects and Suspension
Visualization Tools
Must
Visandor
Vimust
Programming Considerations
The Module System
Basic Concepts
Module Prefixing
Defining Modules
Importation
Module Name Expansion
Meta-Predicate Declarations
Loading Programs
Predicates which Load Code
Declarations
Multifile Declarations
Dynamic Declarations
Block Declarations
Meta-Predicate Declarations
Module Declarations
Public Declarations
Mode Declarations
Parallel and Sequential Declarations
Considerations for File-To-File Compilation
Debugging
The Procedure Box Control Flow Model
Basic Debugging Predicates
Tracing
Spy-points
Format of Debugging messages
Options available during Debugging
Consulting during Debugging
Catching Exceptions
Built-In Predicates
Input / Output
Reading-in Programs
Term and Goal Expansion
Input and Output of Terms
Character Input/Output
Stream IO
DEC-10 Prolog File IO
An Example
Arithmetic
Comparison of Terms
Control
Error and Exception Handling
Information about the State of the Program
Meta-Logic
Modification of Terms
Modification of the Program
Internal Database
Blackboard Primitives
All Solutions
Coroutining
Debugging
Execution Profiling
Muse
Miscellaneous
Mixing C and Prolog
Calling C from Prolog
Interface Predicates
Foreign Language Interface with Static Linking
Support Functions
Creating and Manipulating SP_term_refs
Creating Prolog Terms
Accessing Prolog Terms
Testing Prolog Terms
Unifying and Comparing Terms
Memory Allocation
Calling Prolog from C
Finding One Solution of a Call
Finding Multiple Solutions of a Call
Calling Prolog Asynchronously
Exception Handling in C
SICStus Streams
Prolog Streams
Defining a New Stream
Low Level IO Functions
Installation
Internal Representation
Muse Support Functions
User Hooks
Runtime Systems
Initializing the Prolog Engine
Loading Prolog code
Creating the Executable
Examples
Train Example (connections)
IO on Lists of Character Codes
Exceptions from C
Stream Example
Programming Tips and Examples
Programming Guidelines
Indexing
Last Call Optimization
If-Then-Else Compilation
Programming Examples
Simple List Processing
Family Example (descendants)
Association list primitives
Differentiation
Use of Meta-Logical Predicates
Use of Term Expansion
Prolog in Prolog
Translating English Sentences into Logic Formulae
Muse FLI Example
The Prolog Library
Array Operations
Association Lists
Attributed Variables
Heap Operations
List Operations
Term Utilities
Ordered Set Operations
Queue Operations
Random Number Generator
Operating System Utilities
Updatable Binary Trees
Unweighted Graph Operations
Weighted Graph Operations
Socket IO
Linda--Process Communication
Server
Client
External Storage of Terms (External Database)
Basics
Current Limitations
The DB-Spec--Informal Description
Predicates
An Example Session
The Db-Spec
Boolean Constraint Solver
Solver Interface
Examples
Example 1
Example 2
Example 3
Example 4
Constraint Logic Programming over Rationals or Reals
Introduction
Referencing this Software
Acknowledgments
Solver Interface
Notational Conventions
Solver Predicates
Unification
Feedback and Bindings
Linearity and Nonlinear Residues
How Nonlinear Residues are made to disappear
Isolation Axioms
Numerical Precision and Rationals
Projection and Redundancy Elimination
Variable Ordering
Turning Answers into Terms
Projecting Inequalities
Why Disequations
Syntactic Sugar
Monash Examples
Compatibility Notes
A Mixed Integer Linear Optimization Example
Implementation Architecture
Fragments and Bits
Rationals
Partial Evaluation, Compilation
Asserting with Constraints
Bugs
Prolog Objects
Getting Started
Declared Objects
Object Declaration
Method Declarations
Generic Objects for Easy Reuse
Self, Message Sending, and Message Delegation
Object Hierarchies, Inheritance, and Modules
Inheritance
Differential Inheritance
Use of Modules
Super and Sub
The Keyword Super
Semantic Links to Other Objects
Dynamically Declared Objects
Dynamic Methods
Inheritance of Dynamic Behavior
Creating Objects Dynamically
Object Creation
Method Additions
Parameter Passing to New Objects
Access Driven Programming--Daemons
Instances
Built-In Objects and Methods
Universal Methods
Inlined Methods
The Proto-Object "object"
The built-in object "utility"
Expansion to Prolog Code
The Inheritance Mechanism
Object Attributes
Object Instances
The Object Declaration
The Method Code
Parameter Transfer
Examples
Classification of Birds
Inheritance and Delegation
Prolog++ programs
Generalized Horn Clause Language
Tcl/Tk Interface
Prolog to Tcl
Command Format
Tcl to Prolog
Tk
The Gauge Profiling Tool
IO on Lists of Character Codes
Glue Code Generator
Timeout Predicate
Cross Reference Producer
Summary of Built-In Predicates
Full Prolog Syntax
Notation
Syntax of Sentences as Terms
Syntax of Terms as Tokens
Syntax of Tokens as Character Strings
Escape Sequences
Notes
Standard Operators
References
Predicate Index
Prolog Objects Method Index
Concept Index