Assume I have the following rules:
unify('test', 'this is a test').
run :- write('Enter something: '),
read(X),
unify(X, Y),
write('The answer is '), write(Y).
And then I run it as follows:
?- ['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.
Why does SWI-Prolog unify both test
and 'test'
to unify('test', 'this is a test').
? I came across this while answering a Prolog question on SO. While I was able to answer the person's question, I couldn't explain this particular behavior, and I was wondering if any one else could.