[comp.lang.prolog] prolog

kevin@zeke.UUCP (03/29/87)

I am working my way through the Turbo Prolog tutorial, in attempt to learn
Prolog.  By the way, does anyone have any good textbook suggestions for a
quick, advanced introduction to Prolog?

Anyway, I am stuck on the use of the cut.  There is an exercise in the book
which requires the printing of a tournament between players.  Each player
should only be occur once.  Also, only those players in equal or lower
league may be challenged.  See the book for further info.  Somehow the 
cut is supposed to be the solution, but I don't see it.  The example 
below is as close as I have come, but it doesn't work.

/* exercise 2, tutorial III */

domains
  name=symbol
  league=integer
predicates
  tourney(name,name)
  partner(name,league,name)
  can_challenge (league,league)
  player(name,league)
  flag_end(name)
clauses
  player(tom,3).
  player(tim,3).
  player(tut,3).
  player(sue,2).
  player(sam,2).
  player(sis,2).
  player(joe,1).
  player(jim,1).
  player(jed,1).
  player(end,0).
  can_challenge(P,Q) :- P >= Q.
  tourney(X,Y) :- player(X,Xl),
                  partner(X,Xl,Y).
  partner(X,Xl,Y) :-
                    player(Y,Yl),
                    X <> Y,
                    can_challenge(Xl,Yl),
                    flag_end(Y).
  flag_end(P) :- P <> end,!.


Can anyone help me?


Kevin Buchs   3500 Zycad Dr. Oakdale, MN 55109  (612)779-5548
Zycad Corp.   {rutgers,ihnp4,amdahl,umn-cs}!meccts!zeke!kevin
-- 
Kevin Buchs   3500 Zycad Dr. Oakdale, MN 55109  (612)779-5548
Zycad Corp.   {rutgers,ihnp4,amdahl,umn-cs}!meccts!zeke!kevin

davisb@arthur.cs.purdue.edu.UUCP (04/01/87)

I also purchased Turbo prolog for the sake of learning prolog.  I found,
however, that a better approach was to learn more "standard" prolog
(one without all the PC "extras") first, and then apply it to the Turbo
version.  I think an excellent book for this is  by  BRATKO.  I believe
the title is "Prolog Programming for Artificial Intelligence," but I'm
not positive.

jmunkki@santra.UUCP (Juri Munkki) (10/16/87)

What is the best Prolog for the Macintosh?
Please mail me and I'll summarize in comp.sys.mac.

Juri Munkki
Helsinki University of Technology Computing Centre
jmunkki@santra.hut.fi
jmunkki@fingate.bitnet
jamsoft@hupu.uucp
t33890r@kaira
(In case the first address doesn't work, try the other ones.)

kimba@cogsci.ed.ac.uk (Michael Newton) (03/26/91)

good evening. I am interested in finding something resembling
edinburgh prolog with modules thrown on top, to run on suns (3 &/or 4).
It would need to be cheap, or, preferably, free (to an academic
institution, to wit, this one!). ML-style modules would be ideal.
In a nutshell, i want to write a parametrised natural language
parser, which takes any program with certain core notions, and
extends it. Replies by email please. Ta, m.
-- 
<kimba> aka Michael Newton "Use the bunny, Luke!"