users-prolog
[Top][All Lists]
Advanced

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

Re: General question about better documentation and specific question


From: Salvador Abreu
Subject: Re: General question about better documentation and specific question
Date: Sun, 2 Dec 2001 00:08:12 +0000

> /afs/sfsu.edu/f1/vcs/Prolog/family.pg:20 warning: discontiguous predicate
> father/2 - clause ignored
        [...]

> When I rearrange the facts so that all the father facts are contiguous > and 
> all the mother facts are continguous, i.e.,
        [...]
> there is no problem.  Why is it doing this?

I'd say it's got to do with the compiler nature of gprolog: a set of
clauses for the same predicate is viewed as a "procedure", which must be
defined in one block.

This can be worked around by declaring the predicate as discontiguous,
in this case its clauses would have to be preceded by the directive:

:- discontiguous([father/2, mother/2]).

This is an ISO Prolog feature, so it's not specific to GNU Prolog.  I
guess most books predate the standard, so they may suggest different
approaches.

Check the gprolog manual, around page 44 (chapter on Directives...)

> 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?  

Shapiro and Sterling's "The Art of Prolog" is a very good book, if a
little old.

IIRC the programming examples are fairly close to what you'll have to do
using GNU Prolog.

Best,
Salvador



reply via email to

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