Prolog has two kinds of programming statements: Facts and rules. So far, we have looked at facts. But Prolog with only facts is only half a Prolog. In order to utilize the power of Prolog, rules are needed. This chapter is on Prolog rules.
Overview of this chapter
We will first give an example of a Prolog rule. Then we will introduce some terminology necessary for talking aboout rules and what is called Prolog clauses (facts is one kind of clause; rules are the other kind of clause). After that, we will say a little about when two occurrences of a variable name refers to the same variable (variable scoping rule). After that, we will present a technique for solving a common programming problem in Prolog: How do we return a value from a rule. Finally, there is a quiz.
PrevLite: 10.5 Quiz: Matching
NextLite: 11.1 Example of a rule
Prev: 10.5 Quiz: Matching
Up: Part III: Programming
Next: 11.1 Example of a rule