Falscher Code Vers. prolog 7.6.4?

Hallo, dieser Code lässt sich nicht übersetzen.
Habe ich irgend etwas vergesse anzugeben: Bibliotheken, . . .
https://www.swi-prolog.org/pldoc/man?section=quickstart
?- likes(sam, X).
X = dahl ;
X = tandoori ;

X = chips.
Es passiert folgendes:
[user].
|: likes(sam,X).

Warning: user://1:8:
Singleton variables:
|: X = dahl;
|: X = tandoori;
|: X = chips.

ERROR: user://1:12:
No permission to modify static procedure `(;)/2’
Defined at /usr/lib/swi-prolog/boot/init.pl:209
|: ^D% user://1 compiled 0.01 sec, 1 clauses
true.
Auch wenn ich diesen File standardmäßig übersetze, komme ich zum Fehler.
Was Tun?
Gruß edsw

Using Google translate

Hello, this code cannot be translated.
Did I forget to include something: Libraries, . . .

SWI-Prolog -- Manual

?- likes(sam, X).
X = dall ;
X = tandoori ;
...
X = chips.

The following happens:

[user].
|: likes(sam,X).

Warning: user://1:8:
Singleton variables: [X]
|: X = dall;
|: X = tandoori;
|: X = chips.

ERROR: user://1:12:
No permission to modify static procedure `(;)/2'
Defined at /usr/lib/swi-prolog/boot/init.pl:209
|: ^D% user://1 compiled 0.01 sec, 1 clauses
true.

Even if I translate this file by default, I get the error.
What to do?

Greeting edsw

?- likes(sam,X).
ERROR: Unknown procedure: likes/2 (DWIM could not correct goal)

?- [user].
|    likes(sam,dall).
|    likes(sam,tandoori).
|    likes(sam,chips).
|       Ctrl-D entered
% user://1 compiled 0.00 sec, 3 clauses
true.

?- likes(sam,X).
X = dall ;
X = tandoori ;
X = chips.

Note:

|    likes(sam,dall).

ends with a period . and not a ;.

Dieser Code läuft nur wenn “likes(sam,dall).” steht.
X = dall;
X = chips.
läuft so nicht.
Dieser liegt hier vor
https://www.swi-prolog.org/pldoc/man?section=quickstart
Gruß edsw

before executing
?- likes(sam, X).
you should end the pseudo file user entry command [user] by pressing Ctrl-D.

Hello,
I produce a file called “likes”. The contents : see appendix.
The compilation of this files “likes” goes wrong, both times.
regards
Dieter

Create Prolog source file.

Note: In the next step you can use another directory that your login user has write access, just be consistent.

Note: The file will be a Prolog module. It is really better to start off using Prolog modules because if you eventually do production code you will need modules.

Directory: C:/Users/Groot
File: likes.pl

:- module(example,
    [
      likes/2
    ]).

likes(sam,dahl).
likes(sam,tandoori).
likes(sam,chips).

Start SWI-Prolog

Welcome to SWI-Prolog (threaded, 64 bits, version 8.5.5)

?- working_directory(_,'C:/Users/Groot').
true.

?- [likes].
true.

?- likes(sam,X).
X = dahl ;
X = tandoori ;
X = chips.
1 Like