Generate all permuted pairs in all positions

The question is how to generate all permutations of sequence of numbers. The caveat is to generate the numbers in all positions i.e. [X,Y] and [Y,X], but best to show how it works …

:- initialization(main).

%% for list of items
ppairs(Lst,[A,B]) :- 
   is_list(Lst), length(Lst,N), 
   between(1,N,X), between(1,N,Y), nth1(X,Lst,A), nth1(Y,Lst,B).
%% for numbers
ppairs(N,Pair) :- integer(N), ppairs(1,N,Pair).
ppairs(From, To, [X, Y]) :- between(From, To, X), between(From, To, Y).

main :- 
  %% all pairs of 1 .. 3
  findall(P,ppairs(3,P),L), write(L), write('\n'),
  %% all pairs of a,b,c
  findall(P2,ppairs([a,b,c],P2),L2), write(L2).


----

[[1,1],[1,2],[1,3],[2,1],[2,2],[2,3],[3,1],[3,2],[3,3]]
[[a,a],[a,b],[a,c],[b,a],[b,b],[b,c],[c,a],[c,b],[c,c]]