I am a newbie in Prolog and I've been reading the Prolog section in "Seven Languages in Seven Weeks".
He introduces some basic elements of the language with this file:
friends.pl
---------------
likes(wallace, cheese).
likes(grommit, cheese).
likes(wendolene, sheep).
friend(X, Y) :- \+(X = Y), likes(X, Z), likes(Y, Z).
When I consult that with Gnu Prolog (which variant the author also uses), I get 2 compile errors:
| ?- consult('D:/Steve - D/Documents - D/GNU-Prolog/friends.pl').
compiling D:/Steve - D/Documents - D/GNU-Prolog/friends.pl for byte code... D:/Steve - D/Documents - D/GNU-Prolog/friends.pl:1:6: syntax error: . or operator expected after expression
D:/Steve - D/Documents - D/GNU-Prolog/friends.pl:5:14: syntax error: . or operator expected after expression
2 error(s)
compilation failed
(15 ms) no
For the life of me it looks like I typed in the same example as in the book and that there should be no errors.
Any help would be appreciated.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 491 |
Nodes: | 16 (2 / 14) |
Uptime: | 146:50:42 |
Calls: | 9,694 |
Calls today: | 4 |
Files: | 13,732 |
Messages: | 6,178,670 |