home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / prolog / library / prolo_c / exampl10.pro < prev    next >
Text File  |  1986-10-06  |  292b  |  19 lines

  1. /* Program 10 */
  2. /*
  3.   Goals to enter are on page 42 of the manual.
  4. */
  5.  
  6. domains
  7.     n, f = real
  8.  
  9. predicates
  10.     factorial(n,f)
  11.  
  12. clauses
  13.     factorial(1,1).
  14.     factorial(N,Res) if
  15.         N > 0 and
  16.         N1 = N-1 and
  17.         factorial(N1,FacN1) and
  18.         Res = N*FacN1.
  19.