permutation_rec1([X|Y],Z) :- permutation_rec1(Y,W), select(X,Z,W). permutation_rec1([],[]). permutation_rec2([], []). permutation_rec2([X], [X]) :-!. permutation_rec2([T|H], X) :- permutation_rec2(H, H1), append(L1, L2, H1), append(L1, [T], X1), append(X1, L2, X).