home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / borland / jnfb88.arc / TAIL.ARC / COUNT.PRO < prev    next >
Text File  |  1987-10-22  |  303b  |  22 lines

  1. /* COUNT.PRO */
  2.  
  3. /* Tail recursive program that
  4.    never runs out of memory */
  5.  
  6. PREDICATES
  7.  
  8.    count(real)
  9.  
  10.      /* Reals can be much
  11.         bigger than integers. */
  12.  
  13. CLAUSES
  14.  
  15.    count(N) :- write(N),nl,
  16.                NewN = N+1,
  17.                count(NewN).
  18.  
  19. GOAL
  20.  
  21.    count(1).
  22.