☰
↑
←
→
🔍
TOC
Additional Features of Prolog
and the ISO Standard
»
Table of Contents
ON THIS PAGE
What Prolog adds to pure logic programming
Slide 2 — The ISO Prolog standard
Slide 3 — An overview of the standard
Slide 4 — The programming interface
Syntax and operators
Slide 5 — Prolog syntax and terminology
Slide 6 — Defining operators
Slide 7 — Operators in use
Slide 8 — The standard operator table
Execution and arithmetic
Slide 9 — The execution mechanism of classical Prolog
Slides 10–12 — Built-in arithmetic
Failure versus error
Slide 13 — Arithmetic programs
Goal order now matters in a new way
Exercises
Types, structures and terms
Slide 14 — Dynamic checking of basic types
Slide 15 — Recovering some reversibility
Slide 16 — Structure inspection with
functor
Slide 17 — Structure inspection with
arg
Slides 18–19 — Example: arrays
Slide 19 (contd.) — Syntactic sugar for
arg
Slide 20 — Example: subterms of a term
Slide 21 — Higher-order structure inspection:
univ
Extending
deriv
with the chain rule
Exercises
Slide 22 — Strings, atoms, and creating new atoms
Meta-logical predicates and term comparison
Slide 23 — Meta-logical predicates
Slides 24–25 — Choosing an implementation by calling mode
Slide 26 — Comparing non-ground terms
Slide 27 — Two applications of term comparison
Revisiting
subterm
, for non-ground terms
Inserting into an ordered list
Input/output
Slides 28–29 — The I/O predicates
Two things to remember when writing terms you intend to read back
Slide 30 — An example, and a warning
The cut
Slides 31–32 — The pruning operator
Slide 33 — White and green cuts
White cuts — do not discard solutions
Green cuts — discard correct solutions you did not want
Slide 34 — Red cuts
Slide 35 — Living with red cuts
Slide 36 — Red cuts: the leap year, four ways
The best fix: make the cut white by writing the missing condition
Delaying the output binding: better, but not enough
Checking the mode explicitly
Exercises
Two more examples worth working through
Meta-calls, higher order and aggregation
Slide 37 — Meta-calls and implementing higher order
Inventing
apply
Slide 38 —
call/n
and the higher-order library
maplist
and reversibility
Slide 39 — Ciao's
hiord
package
Slides 40–42 — Aggregation predicates
The set versions:
setof
and
bagof
Exercises
Slides 43–44 — Negation as failure
Making the discipline explicit
Exercises
Slide 45 — Cut-fail
Dynamic program modification and meta-interpreters
Slide 46 — Modifying the program at run time
Slide 47 — Assert and retract in action
Slide 48 — Lemmas: the one clearly good use
Exercises
Slide 49 — Meta-interpreters
Slide 50 — Extending the meta-interpreter
Exercises
Incomplete data structures
Slide 51 — Difference lists
Slide 52 — Playing with difference lists
Slides 53–54 — Quicksort with ordinary lists
Which argument should be a difference list?
Slides 55–57 — Quicksort with difference lists, in three steps
Exercises
Parsing and grammars
Slide 58 — Parsing with
append
and ordinary lists
Slide 59 — The same, with difference lists
Slide 60 — The same again, with string syntax
Slides 61–62 — Definite clause grammars
Slide 63 — Parsing with actions
Exercises
What is left, and where to look
Slide 64 — Other issues in Prolog
Slide 65 — Libraries
Slides 66–68 — Extensions, taking Ciao as the example
Table of Contents