[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: beginner question
From: |
Sylvain Soliman |
Subject: |
Re: beginner question |
Date: |
Sun, 9 May 2010 17:54:36 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
* Luca Ciciriello <address@hidden>:
> 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 <address@hidden> 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/
smime.p7s
Description: S/MIME cryptographic signature
- beginner question, Luca Ciciriello, 2010/05/09
- Re: beginner question,
Sylvain Soliman <=