NextPrevUpTopContentsIndex

A.9.1.2 Example 2: Using extra arguments.

(defgrammar one-of
  ((one-of ?word) ?word))
 
(defgrammar two-of
   ((two-of ?word) (one-of ?word) (one-of ?word)))

Each of these defines a 3-ary relation, whose extra argument is the word to match. When the relations are called, the word will typically be bound to a symbol from the sentence to match.

The following will succeed and bind ?x to the list (foo bar) :

(clog:any '?x '(two-of (start start foo bar) ?x start))

The following will both fail because the sentences do not begin with two start symbols:

(clog:any '?x '(two-of (not-start start foo bar) ?x start))
(clog:any '?x '(two-of (start not-start foo bar) ?x start))

KnowledgeWorks and Prolog User Guide (Macintosh version) - 29 Feb 2008

NextPrevUpTopContentsIndex