:- module(nreverse_rtc_off, [nreverse/2], [assertions, regtypes,
	nativeprops, predefres(res_steps)]).

:- entry nreverse(Xs, Ys) : list(num) * var.
:- pred nreverse(Xs, Ys) : list(num) * term => list(num) * list(num).

nreverse([], []).
nreverse([X|Xs], Ys):-
	nreverse(Xs, Ys0),
	appendlast(Ys0,X,Ys).

appendlast([],X,[X]).
appendlast([E|Y],X,[E|T]):-
	appendlast(Y,X,T).