I'm having trouble solving this prolog problem. Define a postfix predicate so that postfix(X,Y) says that X is a list that is a postfix of Y. That is, each element of X is equal to (unifies with) the corresponding element of Y, but Y may contain additional elements before that.
IN:
postfix(X,[1,2,3]).
OUT:
[]; [3]; [2,3]; [1,2,3];
I tried
postFix(X,[]).
postFix(X,Y) :- append(,X,Y), [H|T] is Y, postfix(,X,T).
Thanks!