I am trying to implement a prolog method that will take a number and return a list of all possible ordered pairs where both X and Y are less than the number given. For example
genXY(2,R).
Should return
R=[0,0];
R=[0,1];
R=[1,0];
R=[1,1].
I am having trouble understanding how to implement this. I have written the code
genN(N,R) :-
N1 is N-1,
between(0,N1,R).
Which will give the following output when executed
genN(3,R).
R=0;
R=1;
R=2;
And I believe that I should use forall to implement genXY but I don't understand how I would go about doing this