Control constructs/predicates

Author(s): Daniel Cabeza, Manuel Hermenegildo.

This module contains the set of basic control predicates, except the predicates dealing with exceptions, which are in Exception and Signal handling.

Usage and interface

Documentation on exports

PREDICATE,/2
P,Q

Conjunction (P and Q).

Usage:ISO

  • The following properties should hold at call time:
    (basic_props:callable/1)P is a term which represents a goal, i.e., an atom or a structure.
    (basic_props:callable/1)Q is a term which represents a goal, i.e., an atom or a structure.
Meta-predicate with arguments: goal,goal.

PREDICATE;/2
P;Q

Disjunction (P or Q). Note that in Ciao |/2 is not equivalent to ;/2.

Usage:ISO

  • The following properties should hold at call time:
    (basic_props:callable/1)P is a term which represents a goal, i.e., an atom or a structure.
    (basic_props:callable/1)Q is a term which represents a goal, i.e., an atom or a structure.
Meta-predicate with arguments: goal;goal.

PREDICATE->/2
P->Q

If P then Q else fail, using first solution of P only. Also, (P -> Q ; R), if P then Q else R, using first solution of P only. No cuts are allowed in P.

Usage:ISO

  • The following properties should hold at call time:
    (basic_props:callable/1)P is a term which represents a goal, i.e., an atom or a structure.
    (basic_props:callable/1)Q is a term which represents a goal, i.e., an atom or a structure.
Meta-predicate with arguments: goal->goal.

PREDICATE!/0

Usage:ISO

Commit to any choices taken in the current predicate.

PREDICATE\+/1
\+P

Goal P is not provable (negation by failure). Fails if P has a solution, and succeeds otherwise. No cuts are allowed in P.

Usage:ISO

  • The following properties should hold at call time:
    (basic_props:callable/1)P is a term which represents a goal, i.e., an atom or a structure.
  • The following properties hold globally:
    (basic_props:native/2)This predicate is understood natively by CiaoPP as not(X).
    (native_props:is_det/1)All calls of the form \+P are deterministic.
Meta-predicate with arguments: \+goal.

PREDICATEif/3
if(P,Q,R)

If P then Q else R, exploring all solutions of P. No cuts are allowed in P.

Usage:if(A,B,C)

Meta-predicate with arguments: if(goal,goal,goal).

PREDICATEtrue/0

Usage:ISO

Succeed (noop).

Other properties:

  • The following properties hold globally:
    (basic_props:eval/1)true is evaluable at compile-time.

PREDICATEfail/0

Usage:ISO

Fail, backtrack immediately.

Other properties:

  • The following properties hold globally:
    (basic_props:eval/1)fail is evaluable at compile-time.

PREDICATErepeat/0

Usage:ISO

Generates an infinite sequence of backtracking choices.

PREDICATEfalse/0

PREDICATEotherwise/0

Documentation on imports

This module has the following direct dependencies: