Type member/2 and append/3
Type member/2 and append/3
Answer
member(X, [X | _]). member(X, [_ | T]) :- member(X, T). append([], B, B). append([H | T], B, [H | R]) :- append(T, B, R).
member: X is in the list if it is the head (clause 1) OR a member of the tail (clause 2). append: the base case joins [] to B giving B; the recursive clause carries the head H across and recurses on the tail. The underscore `_` is the anonymous variable (a value we do not need to name).