* 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/
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Users-prolog mailing list [email protected] http://lists.gnu.org/mailman/listinfo/users-prolog
