%% Wrapper: the accumulator is instantiated with the empty list. mirror(In,Out) :- mirror(In,,Out). %% If we reach the empty list, the accumulator should contain the %% reversed list. Hence, we pass it on to the output argument. mirror(,Out,Out). %% Take the head of the list and attach it to the front of the %% accumulator. This is the accumulator for the recursive call of %% mirror which will process the tail of the list. mirror([Head|Tail],Acc,Out) :- mirror(Tail,[Head|Acc],Out).