Contents
Chapter 1 Introduction
1.1 Intended audience
1.2 Related work
1.3 Structure of tutorial
Chapter 2 High Level Design
2.1 Application structure
2.2 Queries
2.3 API
2.4 High level structure
2.4.1 Classical LSCO structure
2.4.2 Data transformation structure
2.4.3 Data flow considerations
2.5 Modules
2.5.1 Making predicates available
2.5.2 Using packaged functionality
2.6 Naming schemes
2.6.1 Modules and files
2.6.2 Predicates
2.6.3 Variables
2.7 Documentation
2.7.1 Comment directive
2.7.2 Documenting all interfaces
2.7.3 Mode declaration
2.7.4 Documentation query
Chapter 3 Data Structures
3.1 External data representation
3.2 Internal data representation
3.2.1 Named structures
3.2.2 Placeholder variables
3.2.3 Nested structures vs. key lookup
3.2.4 Lists
3.2.5 Hash tables
3.2.6 Vectors and arrays
3.2.7 Multi-representation structures
Chapter 4 Getting it to Work
4.1 Stubs
4.2 Argument checking
4.3 Early testing
4.4 Line Coverage
4.5 Heeding warnings
4.6 Keep it working
Chapter 5 Programming Concepts
5.1 Overview
5.2 Alternatives
5.3 Iteration on lists
5.4 Iteration on terms
5.5 Iteration on array
5.6 Transformation
5.7 Filter
5.8 Combine
5.9 Minimum
5.10 Best and rest
5.11 Sum
5.12 Merge
5.13 Group
5.14 Lookup
5.15 Fill matrix
5.16 Cartesian
5.17 Ordered pairs
Chapter 6 Input/Output
6.1 Reading input data into data structures
6.2 How to use DCGs
6.3 Creating output data files
6.3.1 Creating Prolog data
6.3.2 Simple tabular format
6.3.3 Using
printf
6.4 Good and bad data formats
6.5 Report generation
Chapter 7 If it doesn’t Work
7.1 Understanding failure
7.1.1 Run-time errors
7.1.2 Environment limits
7.1.3 Failure
7.1.4 Wrong answer
7.1.5 Missing answer
7.2 Checking program points
7.3 Debugger
7.3.1 Tracing
7.3.2 Jumping to a program point
Chapter 8 Correctness and Performance
8.1 Testing
8.2 Profiling
8.3 Reviewing
8.4 Issues to check for
8.4.1 Unwanted choicepoints
8.4.2 Open streams
8.4.3 Modified global state
8.4.4 Delayed goals
Appendix A Style Guide
A.1 Style rules
A.2 Module structure
A.3 Predicate definition
Appendix B Layout Rules
B.1 General guidelines
B.2 Predicates and clauses
B.3 If-then-elses
B.4 Disjunctions
B.5 Do loops
B.6 Comments
Appendix C Core Predicates
C.1 Modules
C.2 Predicate definition
C.3 Control
C.3.1 Do Loops
C.4 I/O
C.5 Arrays
C.6 Hash Tables
C.7 Arithmetic
C.8 Terms and structures
C.9 List Handling