Not sure if this a bug but I defined the following:
three_pairs(X,Y,Z, R):-
X =(,),
Y =(,),
Z =(,),
R = (X,Y,Z).
For the query:
three_pairs(,,,Result).
I got the following with out parenthesis around the last pair:
Result = ((, ), (, ), , ).
I expected the following:
Result = ((, ), (, ), (, )).
However, if I do:
three_pairs(,,,(A,B,C)).
I get the following as I would expect:
A = (_, ),
B = (, ),
C = (, _).
So, is there a problem in the console result of:
three_pairs(,,_,Result).
?
Thanks,
viktim
I think queries below are related to your question. I could not explain well. For a long time my experience says that , (comma) , and | ( vertical bar) are something special when they are used as atoms. Thus I also am looking forward to clear answers to be posted by some experts for your questions.
?- write_canonical(',').
','
true.
?- write_canonical((,)).
ERROR: Syntax error: Operand expected, unquoted comma or bar found
ERROR: write_canonical(
ERROR: ** here **
ERROR: (,)) .
Thank you everyone for your responses and links to related discussions. I now know a bit more about SWI-Prolog, pairs, comma lists and comma operator. I will name the pairs as it seems to be the recommended solution.