What does the “-” symbol mean in Prolog when dealing with lists?
问题 I was reading the answer to this question, p(X) :- read(A), q(A,X-[]). q(end,X-X) :- !. q(A,[A|X]-Y) :- read(B), q(B,X-Y). The code above uses the syntax List-List . I somewhat understand what is going on, but I want to know what exactly what the "-" symbol/predicate does here. Also, is this SWI specific? 回答1: The (-)/2 to represent difference lists is a rather uncommon convention. In older books, another operator (\)/2 was used too. Many prefer to use two separate arguments instead. There