improve reverse/2
@@ -41,11 +41,11 @@ append([X|L], R, [X|S]) :- append(L, R, S).
memberchk(X, Xs) :- member(X, Xs), !.
-reverse(Xs, Ys) :- reverse(Xs, [], Ys).
+reverse(Xs, Ys) :- reverse(Xs, Ys, [], [], Xs).
-reverse([], Ys, Ys).
-reverse([H|T], Ps, Rs) :-
- reverse(T, [H|Ps], Rs).
+reverse([], [], XsRev, YsRev, YsRev).
+reverse([X1|Xs], [Y1|Ys], XsPreludeRev, YsPreludeRev, Xss) :-
+ reverse(Xs, Ys, [X1|XsPreludeRev], [Y1|YsPreludeRev], Xss).
maplist(_, []).
maplist(Cont1, [E1|E1s]) :-
@@ -86,4 +86,3 @@ maplist(_, [], [], [], [], [], [], [], []).
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s], [E7|E7s], [E8|E8s]) :-
call(Cont, E1, E2, E3, E4, E5, E6, E7),
maplist(Cont, E1s, E2s, E3s, E4s, E5s, E6s, E7s, E8s).
-
