Module 15 Study Guide
Learning Objectives (Prolog, CPL Ch.16)
We are learning elementary Prolog to get a taste of declarative and logical programming. As with functional programming, declarative programming is an entirely different way of thinking about programming from what you are used to. It is also quite different from functional programming. Specifically, by the end of the module you should be able to
- Run and exit the
swipl
interpreter - Create and load a Prolog program into the
swipl
interpreter - Run queries in the
swipl
interpreter and understand the results - Write Prolog facts using predicates and atoms
- Write Prolog rules using variables and recursion
- Understand how the Prolog interpreter’s inference engine works
- Write rules using the cut (
!
), the not predicate (\+
), and the anonymous variable (_
) - Write test cases that can be run after a program is loaded
Resources
- CPL Chapter 16
- Download SWI-Prolog
- SWISH Interactive Online Prolog
- Learn Prolog Now! online book
Lab
Please complete the lab. You may begin it any time. You should try to finish it by Wednesday so you can start working on the programming assignment.
Programming Assignment
Please complete the project and submit your code on Canvas by the due date.