app([],Ys,Ys).
app([X|Xs],Ys,[X|Zs]) :- app(Xs,Ys,Zs).

rev([],[]).
rev([X|Xs],Rs) :- rev(Xs,Ys), app(Ys,[X],Rs).


app_dl(L-M, M-N, L-N).

rev_dl([], L,L).
%rev_dl([X|Xs],L-M) :- rev_dl(Xs, UR-T), app_dl(UR-T, [X|N]-N, L-M).
rev_dl([X|Xs],L,M) :- rev_dl(Xs, L,[X|M]).

revdl(Xs,Rs) :- rev_dl(Xs,Rs,[]).

