permutation(L,[H|T]) :- append(V,[H|U],L), append(V,U,W), permutation(W,T). permutation([],[]).