delete(X,[X|Tail],Tail).
delete(X,[Y|Tail],[Y|Tail1]):-delete(X,Tail,Tail1).
insert(X,List,B):-delete(X,B,List).
per([],[]).
per([X|L],P):-per(L,L1),insert(X,L1,P).
Output
per([a,b,c],P).
P=["a","b","c"]
P=["b","a","c"]
P=["b","c","a"]
P=["a","c","b"]
P=["c","a","b"]
P=["c","b","a"]
0 comments:
Post a Comment