home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / prolog / 1528 < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.4 KB  |  35 lines

  1. Newsgroups: comp.lang.prolog
  2. Path: sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!ulysses!meskes
  3. From: meskes@ulysses.informatik.rwth-aachen.de (Michael Meskes)
  4. Subject: Help on problem needed!
  5. Message-ID: <meskes.713709771@ulysses>
  6. Keywords: help
  7. Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
  8. Nntp-Posting-Host: ulysses
  9. Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
  10. Date: 13 Aug 92 12:42:51 GMT
  11. Lines: 22
  12.  
  13. Not having much experience in Prolog programming I have one question which
  14. seems very difficult to me:
  15.  
  16. Can you program a IF...THEN...ELSE in Prolog without using the cut?
  17.  
  18. Let me explain my problem in a few words:
  19. I have a predicate A/3 containing some tuple (X,Y,Z), where Z maybe 0 or 1.
  20. There is a tuple (X,Y,1) for all (X,Y), but there does not have to be a (X,Y,0).
  21. What I want to have is a predicate B/3 containing exactly one tuple (X,Y,U)
  22. for all (X,Y) with U is the lowest Z for which a(X,Y,Z). is true. Or formulated
  23. in another language:
  24. IF (exists a(X,Y,0)) THEN b(X,Y,Z) = a(X,Y,0) ELSE b(X,Y,Z) = a(X,Y,1).
  25. By the way, I need to program this without the cut and without using list data
  26. structures not supported by my test system.
  27.  
  28. Can anyone help me? Thanks in advance.
  29.  
  30. Michael
  31. -- 
  32. Michael Meskes, Lehrstuhl fuer angewandte Mathematik insb. Informatik,
  33. RWTH-Aachen, Ahornstr. 55, D-W-5100 Aachen
  34. Email: meskes@ulysses.informatik.rwth-aachen.de
  35.