All Manuals > KnowledgeWorks and Prolog User Guide > A Common Prolog > A.13 Adding Built-in Predicates

NextPrevUpTopContentsIndex

A.13.1 The defdetpred form

The syntax of this form is

(defdetpred <name> <num args> <body>)

which defines a simple predicate that just runs Lisp code and does not have to unify any variables. Arguments are referenced with: (special-arg <num>). The body succeeds by default, but if a failure case arises, use: (detpred-fail <name> <num args>).

For example

(defdetpred my-integer 1
  (unless (integerp (special-arg 0))
  (detpred-fail my-integer 1)))

KnowledgeWorks and Prolog User Guide (Macintosh version) - 24 Mar 2017

NextPrevUpTopContentsIndex