From dwages@Avaya.com Mon Mar 26 23:54:11 2001
Received: from iere.net.avaya.com (iere.net.avaya.com [198.152.12.101])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f2QLsB322006
	for <prolog@swi.psy.uva.nl>; Mon, 26 Mar 2001 23:54:11 +0200 (MET DST)
Received: from iere.net.avaya.com (localhost [127.0.0.1])
	by iere.net.avaya.com (8.11.2/8.9.3) with ESMTP id f2QLrh618881
	for <prolog@swi.psy.uva.nl>; Mon, 26 Mar 2001 16:53:44 -0500 (EST)
Received: from bighorn.dr.avaya.com (h135-9-1-59.avaya.com [135.9.1.59])
	by iere.net.avaya.com (8.11.2/8.9.3) with SMTP id f2QLrff18833;
	Mon, 26 Mar 2001 16:53:41 -0500 (EST)
Received: from COF110DWAGES by bighorn.dr.avaya.com (SMI-8.6/EMS-1.5 sol2)
	id OAA17114; Mon, 26 Mar 2001 14:54:23 -0700
Reply-To: <dwages@Avaya.com>
From: "Danny Wages" <dwages@Avaya.com>
To: "'Ryo Saeba'" <saibaryo@excite.com>,
   "SWI SWI \(E-mail\)" <prolog@swi.psy.uva.nl>
Subject: RE: [SWIPL] I need help about my code
Date: Mon, 26 Mar 2001 14:54:20 -0700
Message-ID: <000c01c0b63f$507ce090$03270987@COF110DWAGES>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0)
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
In-Reply-To: <31907213.985641896466.JavaMail.imail@batty.excite.com>

Simply remove the repeat and add a P(_N) clause.

Danny Wages :- Avaya Communication, 303-538-3972, dwages@Avaya.com
<mailto:dwages@Avaya.com>


-----Original Message-----
From: Ryo Saeba [mailto:saibaryo@excite.com]
Sent: Monday, March 26, 2001 2:25 PM
To: prolog@swi.psy.uva.nl
Subject: [SWIPL] I need help about my code


Hi! there:

course_name(cs5373, 'Database Systems').
course_name(cs5393, 'Automata Theory').
course_name(cs5463, 'Computer Networks').
course_name(cs5483, 'Artificial Intelligence').
course_name(cs5493, 'Computer Graphics I').
course_name(cs5503, 'Computer Graphics II').
course_name(cs5523, 'Software Engineering I').
course_name(cs5533, 'Software Engineering II').
course_name(cs5583, 'UNIX Systems Programming').
course_name(cs5703, 'Analysis of Algorithms').
course_name(cs5793, 'Compilers').
course_name(cs5903, 'Distributed Computing').
course_name(cs6483, 'Advanced Artificial Intelligence').
course_name(cs6493, 'Robotic Software Control').
course_name(cs6603, 'Computer Performance Evaluation').
course_name(cs6623, 'Data Security').
course_name(cs6673, 'Natural Language Processing').
course_name(cs6703, 'Advanced Analysis of Algorithms').
course_name(cs6783, 'Computability Theory').
course_name(cs6833, 'Parallel Processing').

person_course(danid, 1999, fall, cs5523).
person_course(danid, 2000, spring, cs5393).
person_course(danid, 2000, spring, cs5533).
person_course(danid, 2000, fall, cs5493).
person_course(danid, 2000, fall, cs5703).
person_course(danid, 2001, spring, cs5463).
person_course(danid, 2001, spring, cs5503).
person_course(danid, 2001, spring, cs6673).
person_course(danid, 2001, spring, cs6703).


  I wrote a program about Database. I tried to list all of
the courses that danid has taken, if I use

p(N) :-
        repeat,
        person_course(N, _, _, C),
        course_name(C, CT),
        display(C), put(32), display(CT), nl,
        fail.

after I consult this program and I wrote
?- p(danid).

The screen will repeat to list all course danid has taken
again and again.

If I use

p(N) :-
        person_course(N, _, _, C),
        course_name(C, CT),
        display(C), put(32), display(CT), nl.

then computer only give me the first course danid has taken.

Does anybody know how can I fixed my problem
Thanks!






_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/



----------------
* To UNSUBSCRIBE, please use the HTML form at

    http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist

or send mail to prolog-request@swi.psy.uva.nl using the Subject:
"unsubscribe"
(without the quotes) and *no* message body.

** An ARCHIVE of this list is maintained at

    http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/

