Article View: comp.lang.prolog
Article #630Help on problem needed!
From: Michael Meskes
Date: Thu, 13 Aug 1992 12:42
Date: Thu, 13 Aug 1992 12:42
22 lines
1446 bytes
1446 bytes
Not having much experience in Prolog programming I have one question which seems very difficult to me: Can you program a IF...THEN...ELSE in Prolog without using the cut? Let me explain my problem in a few words: I have a predicate A/3 containing some tuple (X,Y,Z), where Z maybe 0 or 1. There is a tuple (X,Y,1) for all (X,Y), but there does not have to be a (X,Y,0). What I want to have is a predicate B/3 containing exactly one tuple (X,Y,U) for all (X,Y) with U is the lowest Z for which a(X,Y,Z). is true. Or formulated in another language: IF (exists a(X,Y,0)) THEN b(X,Y,Z) = a(X,Y,0) ELSE b(X,Y,Z) = a(X,Y,1). By the way, I need to program this without the cut and without using list data structures not supported by my test system. Can anyone help me? Thanks in advance. Michael -- Michael Meskes, Lehrstuhl fuer angewandte Mathematik insb. Informatik, RWTH-Aachen, Ahornstr. 55, D-W-5100 Aachen Email: meskes@ulysses.informatik.rwth-aachen.de
Technical Details
Message-ID:
<meskes.713709771@ulysses>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!ulysses!meskesShow Full Headers
Complete Article Headers
Newsgroups: comp.lang.prolog Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!ulysses!meskes From: meskes@ulysses.informatik.rwth-aachen.de (Michael Meskes) Subject: Help on problem needed! Message-ID: <meskes.713709771@ulysses> Keywords: help Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner) Nntp-Posting-Host: ulysses Organization: Rechnerbetrieb Informatik / RWTH Aachen Date: 13 Aug 92 12:42:51 GMT Lines: 22