LARA

Prolog Examples

app([],Y,Y).
app([H|T], Y, [H|Z]) :- app(T, Y, Z).
?- app(X, Y, [1,2,3,4,5]).
 
X = [],
Y = [1, 2, 3, 4, 5] ;
 
X = [1],
Y = [2, 3, 4, 5] ;
 
X = [1, 2],
Y = [3, 4, 5] ;
 
X = [1, 2, 3],
Y = [4, 5] ;
 
X = [1, 2, 3, 4],
Y = [5] ;
 
X = [1, 2, 3, 4, 5],
Y = [] ;