I'm totally new to Prolog. So please excuse this possibly extermely simple qiuestion: I have a few facts like
likes(peter,cars).
likes(maria,bikes).
likes(walter,bikes).
likes(paul,bikes).
likes(paul,cars).
in a file likes.pl
. Now I'm trying to check whether paul
likes cars
and bikes
, so I tried on GNU Prolog's REPL:
| ? - [likes].
| ? - likes(paul,bikes) #\/ likes(paul,cars).
but I get "uncaught exception:...". Obviously I'm doing something wrong. - How can I combine two facts with an AND in GNU Prolog?
The operator you are using #\/
is a Boolean Finite Domain operator used in constraint programming clp(b)
.
If you just want a conjunction of two facts A and B, use A, B
. If you want a disjunction of them use A; B
.
In your case you can just type likes(paul, bikes), likes(paul, cars).
.