What's an elegant way to unify X,Y with (1,2), (1,-2), (-1,2), (-1,-2), (2,1), (2,-1) , (-2,1), (-2,-1)?
Doing it this way seems error prone and tedious:
foo(1,2).
foo(1,-2).
foo(-1,-2).
...
...
...
And this way seems too expensive:
foo(X,Y) :-
L = [1,-1,2,-2],
member(X,L),
member(Y,L),
abs(X,X1), abs(Y,Y1),
X1 =\= Y1.