NextPrevUpTopContentsIndex

deftactic

Macro
Syntax

deftactic tactic-name type lambda-list &rest body

Arguments

tactic-name is a symbol. type is either :static or :dynamic . lambda-list is a two argument lambda-list. body is a function body.

Description

Defines a new conflict resolution tactic of the given name. The type of the tactic may be :static if the body does not look into the slots of the objects making up the instantiation, otherwise :dynamic . The lambda-list binds to two instantiation objects and the function body body should return non- nil if and only if the first instantiation object is preferred to the second. deftactic also defines a function of the same.

The newly defined tactic may be used as any in-built tactic.

Values

Returns tactic-name .

Examples
(deftactic prefer-trucks :static (inst1 inst2)
  (flet ((truck-p (obj) (typep obj 'truck)))
    (and (some #'truck-p (inst-token inst1))
      (notany #'truck-p (inst-token inst2)))))

The new tactic may be used in a defcontext form:

(defcontext my-context :strategy (prefer-trucks))
See also

inst-bindings

inst-token

inst-rulename


KnowledgeWorks and Prolog User Guide (Macintosh version) - 4 Apr 2005

NextPrevUpTopContentsIndex