[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
PrologDeterm
A deterministic clause can only produce one solution. A clause that can produce more solutions is called a non-determininistic clause, which is indicated by the keyword nondeterm.
Do not confuse determ with 'knowable beforehand', also a randomly determined predicate can be determ, if it only returns one single value.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
PrologDeterm
(Prolog) determ
Shorthand for deterministic, a predicate mode. By default, all global predicates are determ.A deterministic clause can only produce one solution. A clause that can produce more solutions is called a non-determininistic clause, which is indicated by the keyword nondeterm.
Example of determ clauses
predicates
determ isOdd(integer).
determ isEven(integer).
clauses
isOdd(X) IF
(X mod 2) = 1.
isEven(X) IF
(X mod 2) = 0.
goal
isEven(1).
Note you can declare these clauses nondeterm, but this will not give you compiler protection.Do not confuse determ with 'knowable beforehand', also a randomly determined predicate can be determ, if it only returns one single value.
predicates
determ isHead().
clauses
isHead() IF
random(X),
X < 0.5 .
goal
isHead().
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
