Re: beginner question (SOLVED)

Luca Ciciriello <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Yes, you are right.  I haven't noticed the warning.
I've made contiguous the statements. All solved.

Thanks.

Luca.
On May 9, 2010, at 5:54 PM, Sylvain Soliman wrote:

> * Luca Ciciriello <[email protected]>:
>> I've created the file test2.pl with the following content:
>> 
>> listensToMusic(mia). 
>> happy(yolanda). 
>> playsAirGuitar(mia) :- listensToMusic(mia). 
>> playsAirGuitar(yolanda) :- listensToMusic(yolanda). 
>> listensToMusic(yolanda):- happy(yolanda).
>> 
>> and I've loaded it in to interpreter typing [test2].
> 
> And you have seen a warning message:
> "test2.pl:5: warning: discontiguous predicate listensToMusic/1 - clause
> ignored"
> 
>> now the book is telling me that if I type at the prompt the query:
>> 
>> ?- playsAirGuitar(yolanda).
>> 
>> the result i obtain is "yes".
>> 
>> My problem is that the result I obtain is a big "no".
>> 
>> Now, as student, I'm a bit confused.
>> Who is right and who is wrong?
>> The book or the interpreter?
> 
> Hmmm... both!
> 
> GNU Prolog does not allow discontiguous predicates (and told you so!), so
> "no" is correct... However the book is correct "in general", and if you
> make the two clauses of listenToMusic contiguous (just one after the other)
> it will work.
> 
> Best,
> 
>        Sylvain.
> 
> -- 
> Sylvain Soliman <[email protected]>         Tel: (+33) 1 39635761
> INRIA Paris-Rocquencourt - Equipe CONTRAINTES      Fax: (+33) 1 39635469
> Domaine de Voluceau, Rocquencourt, BP 105   GnuPG Public Key: 0x0F53AF99
> 78153 LE CHESNAY CEDEX - FRANCE    http://contraintes.inria.fr/~soliman/
> _______________________________________________
> Users-prolog mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/users-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.