% append/3 is predefined in SWI Prolog, so we call ours my_append/3
my_append([],L,L).
my_append([H|T],L,[H|R]) :-
        my_append(T,L,R).

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

% reverse/3 is predefined in SWI Prolog, so we call ours my_reverse/3
my_reverse(A,B) :-
        reverse_aux(A,[],B).

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