[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
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().


last edited (December 4, 2006) by bilderbikkel, Number of views: 1599, Current Rev: 7 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.