% member member1(X, [X | Y]). member1(X, [_ | B]) :- member(X, B). % append(list1, list2, result) append1([], L2, L2). append1([A | B], L2, [A | C]) :- append(B, L2, C). % revert(L1, L2) revert(List,RevList):- rev(List,[],RevList). rev([H|T],S,R):- rev(T,[H|S],R). rev([],R,R). perm([H|T],Perm):- perm(T,SP),insert(H,SP,Perm). perm([],[]). insert(X,T,[X|T]). insert(X,[H|T],[H|NT]):- insert(X,T,NT).
![](https://img2024.cnblogs.com/blog/35695/202403/35695-20240328092537879-1189167464.jpg)