home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / prolog / 1535 < prev    next >
Encoding:
Internet Message Format  |  1992-08-14  |  1.1 KB

  1. Path: sparky!uunet!mcsun!uknet!edcastle!aiai!ken
  2. From: ken@aiai.ed.ac.uk (Ken Johnson)
  3. Newsgroups: comp.lang.prolog
  4. Subject: Re: transitive and symetric relations
  5. Message-ID: <7199@skye.ed.ac.uk>
  6. Date: 14 Aug 92 10:21:09 GMT
  7. References: <SWK.92Aug10220513@seymour.mlb.semi.harris.com> <189@syllogi.syllogic.nl> <1992Aug13.111745.17980@odin.diku.dk>
  8. Followup-To: comp.lang.prolog
  9. Organization: Bugs-R-Us
  10. Lines: 25
  11.  
  12.  
  13. In article <1992Aug13.111745.17980@odin.diku.dk> torbenm@diku.dk (Torben
  14. AEgidius Mogensen) writes:
  15.  
  16. #  A correct formulation of the transitive clause is
  17. #
  18. #  distance(X,Z,D) :-
  19. #    distance_fact(X,Y,D1),
  20. #    distance(Y,Z,D2),
  21. #    D is D1 + D2.
  22.  
  23. This may loop indefinitely.  For instance, suppose you invoked it with
  24.  
  25.          ?- distance(london,paris,X).
  26.  
  27. when `paris' was not mentioned in any distance fact.
  28.  
  29. -- Ken "old lag" Johnson
  30.  
  31.  
  32. -- 
  33. ////  Advice to dieters:          ////  Ken Johnson, A I Applications Institute
  34. ////    Never eat more than       ////       80 South Bridge, EDINBURGH EH1 1HN
  35. ////    you can carry.            ////                 E-mail ken@aiai.ed.ac.uk
  36. ////               -- Miss Piggy  ////     phone 031-650 2756  fax 031-650 6513
  37.