users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

General question about better documentation and specific question


From: Violetta Cavalli-Sforza
Subject: General question about better documentation and specific question
Date: Sat, 1 Dec 2001 14:18:47 -0800 (PST)

Hi,

I'm a beginning Prolog user (I programmed in Prolog many years 
ago for a course and then forgot completely how to) and I'm 
trying to use GNU Prolog for one of my courses.  The problem I'm 
running into is that I find the documentation available online
for the system painfully insufficient to get me started and
the syntax expected by the interpreter doesn't always seem to be 
consistent with the books I'm reading. And sometimes the errors 
are downright obscure.

Consider for example this program:

parent(X,Y) :- father(X,Y).
parent(X,Y) :- mother(X,Y).
grandparent(X,Z) :- parent(X,Y), parent(Y,Z).
ancestor(X,Z) :- parent(X,Z).
ancestor(X,Z) :- parent(X,Y), ancestor(Y,Z).
sibling(X,Y) :- mother(M,X), mother(M,Y), father(F,X), father(F,Y), X \=
Y. 
cousin(X,Y) :- parent(U,X), parent(V,Y), sibling(U,V).

father(albert,jeffrey).
mother(alice, jeffrey).
father(albert, george).
mother(alice, george).
father(john,mary).
mother(sue,mary).
father(george,cindy).
mother(mary,cindy).
father(george,victor).
mother(mary,victor).

When I load it, I get the error messages:
| ?- consult('family.pg').
compiling /afs/sfsu.edu/f1/vcs/Prolog/family.pg for byte code...
/afs/sfsu.edu/f1/vcs/Prolog/family.pg:20 warning: discontiguous predicate
father/2 - clause ignored
/afs/sfsu.edu/f1/vcs/Prolog/family.pg:21 warning: discontiguous predicate
mother/2 - clause ignored
/afs/sfsu.edu/f1/vcs/Prolog/family.pg:22 warning: discontiguous predicate
father/2 - clause ignored
/afs/sfsu.edu/f1/vcs/Prolog/family.pg:23 warning: discontiguous predicate
mother/2 - clause ignored
/afs/sfsu.edu/f1/vcs/Prolog/family.pg:24 warning: discontiguous predicate
father/2 - clause ignored
/afs/sfsu.edu/f1/vcs/Prolog/family.pg:25 warning: discontiguous predicate
mother/2 - clause ignored
/afs/sfsu.edu/f1/vcs/Prolog/family.pg:26 warning: discontiguous predicate
father/2 - clause ignored
/afs/sfsu.edu/f1/vcs/Prolog/family.pg:27 warning: discontiguous predicate
mother/2 - clause ignored
/afs/sfsu.edu/f1/vcs/Prolog/family.pg compiled, 27 lines read - 2222 bytes
written, 60 ms

and the interpreter ignores everything from "father(albert, george)."
down.

yes
| ?- father(X, Y).

X = albert
Y = jeffrey

yes
| ?- 

When I rearrange the facts so that all the father facts are contiguous 
and all the mother facts are continguous, i.e.,

/* facts */
father(albert,jeffrey).
father(albert,george).
father(john,mary).
father(george,cindy).
father(george,victor).
mother(alice,jeffrey).
mother(alice,george).
mother(sue,mary).
mother(mary,cindy).
mother(mary,victor).

there is no problem.  Why is it doing this?

I've also had various difficulties (finally resolved through trial and
error and asking more expert Prolog users) regarding the syntax expected
by this system.

In general, can someone point me to a better source of information than 
the manual that is available from the web page for information about how
to use this environment, syntax expected, and a richer set of examples?  

Thank you.

Violetta
+-------------------------------------------------------------------
| Violetta Cavalli-Sforza, PhD
| Assistant Professor of Computer Science
| E-mail: address@hidden
| Web: http://www.carnegietech.org/~violetta/Personal/index.html
|      http://cs.sfsu.edu/people/faculty_info.html
| Office:     Phone: (415) 338-2207  Room: Thornton 946
| Department: Phone: (415) 338-2156  Fax: (415) 338-6826  Room: 906
| Mail Address:
|   Department of Computer Science // San Francisco State University
|   1600 Holloway Avenue, TH 906  // San Francisco, CA 94132
+-------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]