/* the empty list is denote by [] */ /* [x,y] denotes a list of two elements */ /* [H|T] is a list of possibly many elements where H is the head and T is the rest of the list */ append2([],X,X). /*base case*/ append2([H|T], X,[H|L]) :- append2(T,X,L). /**/ twoelement([A,B],A,B). /* say yes to two element lists where H is the first element and T is the second */ rev2([],[]). /*base case*/ rev2([H|T],X) :- rev2(T,Y),append2(Y,[H],X).