home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l217 / 2.ddi / EXAMPLES / CH08EX04.PRO < prev    next >
Encoding:
Text File  |  1990-03-26  |  421 b   |  19 lines

  1. /*
  2.    Copyright (c) 1986, 90 by Prolog Development Center
  3. */
  4.     
  5. trace
  6. domains
  7.    list = integer*
  8.  
  9. predicates
  10.    add1(list, list)
  11.  
  12. clauses
  13.    add1([], []). /* boundary condition */
  14.    add1([Head|Tail], [Head1|Tail1]) :- /* separate the head */
  15.  /* from the rest of the list */
  16.       Head1= Head+1, /* add 1 to the first element */
  17.       add1(Tail, Tail1). /* call element with the rest of the
  18. list */
  19.