次のルールがあるとします。
unify('test', 'this is a test').
run :- write('Enter something: '),
read(X),
unify(X, Y),
write('The answer is '), write(Y).
そして、次のように実行します。
?- ['unify.pl'].
% unify.pl compiled 0.00 sec, -48 bytes
true.
?- run.
Enter something: test.
The answer is this is a test
true.
?- run.
Enter something: 'test'.
The answer is this is a test
true.
test
SWI-Prolog が と の両方を'test'
に統一するのはなぜunify('test', 'this is a test').
ですか? SOに関するPrologの質問に答えているときに、これに遭遇しました。私はその人の質問に答えることができましたが、この特定の行動を説明することはできませんでした。