list_reversed(Xs, Ys) :-
list_reversed(Xs, Ys, []).
list_reversed([], Ys, Ys).
list_reversed([X|Xs], Ys0, Ys) :-
list_reversed(Xs, Ys0, [X|Ys]).
:- pe list_reversed([X1,X2,X3|Xs], Ys).
@@ list_reversed([B,C,D|E], A) :-
@@ 'list_reversed.1'(B, C, D, E, A).
@@
@@ % 'list_reversed.1'(A,B,C,D,E):-list_reversed([A,B,C|D],E)
@@ 'list_reversed.1'(A, B, C, D, E) :-
@@ list_reversed2(D, E, C, B, A, []).
@@
@@ % list_reversed2(A,B,C,D,E,[]):-list_reversed(A,B,[C,D,E])
@@ list_reversed2([], [A,B,C|D], A, B, C, D).
@@ list_reversed2([F|G], A, B, C, D, E) :-
@@ list_reversed2(G, A, F, B, C, [D|E]).
----- n599 ------------------------
Aha, the arity of the recursive predicate list_reversed2
(that's where the time goes) seems to increase with the size of the
given list.
To be sure, add five more elements and
.
[logprog|GUPU|UWN]