1
votes

I'm very new to prolog and I'm trying to (self) learn from the basics using SWI-Prolog (windows version). This question of mine is certainly a newbie problem, plese forgive my naivety.

I am working with the main interactive window, trying to follow a tutorial (this one) but there's one thing I do not understand about SWI-prolog answers.

The way I understand it, SWI-Prolog responds by writing with "true" or "false" to my query and I'm able to follow the tutorial and get the results espected.

What confuses me is that SWI print his answers using two colors, red and black. Sometimes the answers are written in red, sometimes are written in black, sometimes I get two opposite responses [ like: "true ; false"] and one is black and the other one red!

I have searched into SWI-prolog docs but but have not been able to find the meaning of the two different colors in the responses.

Can someone point me to the relevant SWI documentation or explain why this happen?

EDIT:

To sum up:

What is the difference between a "true" answer written in red and one writtend in black ?

And the difference between a "false" answer written in red and one written in black?

1
As far as I know, red is used to indicate failure or an error. Otherwise, black is used.Dan455
That's the point: what is the difference between a "true" answer written in red and one writtend in black ? And the difference between a "false" answer written in red and one written in black? Surely there is a meaning but I do no undestand it.DavAlPi
Can you give me an example of a "true" answer written in red, or a "false" answer written in black? I have never encountered such a thing.Dan455
So red is for a failure and black is for an answer found in the database? That is the rule ? ok, thanks for the answer.DavAlPi
Not entirely sure what you mean by "found in the database". If Prolog can find a term that satisfies the goal according to the given rules and clauses, it will show you that term as output. If you have a goal where there are no unbound variables, and that goal can be resolved to true according to the rules/clauses, it will output "true" in black. Otherwise it will output "false" in red.Dan455

1 Answers

1
votes
  1. Red indicate New;Stand alone(no recursive)
  2. Black indicate Recursive
  3. Blue indicate defined in SWI-PROLOG

Hope this helpful.