% -----------------------------------------
% append to concatenate two lists

append([],L,L).
append([H|T],L,[H|R]) :-
	append(T,L,R).

% -----------------------------------------
% naive reverse, using append

naive_reverse([],[]).
naive_reverse([H|T],Result) :-
	naive_reverse(T,Aux),
	append(Aux,[H],Result).

% -----------------------------------------
% reverse using an accumulator

reverse(A,B) :- 
	reverse_aux(A,[],B).

reverse_aux([],L,L).
reverse_aux([H|T],L,Result) :- 
	reverse_aux(T,[H|L],Result).

