Next Prev Up Top Contents Index

6.2.3.1 Pattern Matching

The KnowledgeWorks Backward Chainer indexes clauses for a backward rule based on the first argument. If the first arguments to backward rule clauses are distinct non-variables, the backward chainer can pre-select possible matching clauses for a call.

For example, in the following rule:

(defrule age-of :backward
                ((age-of charlie 30) <--)
                ((age-of william 25) <--)
                ((age-of james 28) <--))

The call: (age-of james ?x) would jump directly to the third clause and bind ?x to 28 without trying the other two.

The call: (age-of tom ?x) would fail immediately without doing any pattern matching.

Clauses are distinguished first by the types and then the values of their first arguments.


LispWorks KnowledgeWorks and Prolog User Guide - 14 Dec 2001

Next Prev Up Top Contents Index