home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l217 / 2.ddi / EXAMPLES / CH08EX01.PRO < prev    next >
Encoding:
Prolog Source  |  1990-03-26  |  418 b   |  21 lines

  1. /*
  2.    Copyright (c) 1986, 90 by Prolog Development Center
  3. */
  4.    
  5. domains
  6.    list = integer* /* or whatever type you wish to use */
  7.  
  8. predicates
  9.    write_a_list(list)
  10.  
  11. clauses
  12.    write_a_list([]). /* If the list is empty, do nothing more. */
  13.  
  14.    write_a_list([H|T]) :- /* Match the head to H and the tail to
  15. T, then... */
  16.       write(H), nl,
  17.       write_a_list(T).
  18.  
  19. goal
  20.    write_a_list([1, 2, 3]).
  21.