% permutations.pl % A Prolog program for finding all permutations of a list. % S. Tanimoto, Spring 2003. remove(H, [H|T], T). remove(A, [H|T], [H|B]) :- remove(A, T, B). permutation([], []). permutation([H|T], X) :- remove(H, X, Y), permutation(T, Y). % permutation(X, [fee,fie,foe,foo]).