From saibaryo@excite.com Mon Mar 26 23:25:09 2001
Received: from kuku.excite.com (kuku-rwcmta.excite.com [198.3.99.63])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f2QLP8320767
	for <prolog@swi.psy.uva.nl>; Mon, 26 Mar 2001 23:25:08 +0200 (MET DST)
Received: from batty.excite.com ([199.172.152.107]) by kuku.excite.com
          (InterMail vM.4.01.02.39 201-229-119-122) with ESMTP
          id <20010326212456.ZJNO22770.kuku.excite.com@batty.excite.com>
          for <prolog@swi.psy.uva.nl>; Mon, 26 Mar 2001 13:24:56 -0800
Message-ID: <31907213.985641896466.JavaMail.imail@batty.excite.com>
Date: Mon, 26 Mar 2001 13:24:56 -0800 (PST)
From: Ryo Saeba <saibaryo@excite.com>
To: prolog@swi.psy.uva.nl
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Excite Inbox
X-Sender-Ip: 147.97.12.175
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/


