Reverse/2 why related to a reverse/4 in spite of a reverse/3?

Using lpn:

accRev([H|T],A,R):-  accRev(T,[H|A],R).
accRev([],A,A).

rev(L,R):-  accRev(L,[],R).
?- rev(X, [a,b]).
ERROR: Stack limit (1.0Gb) exceeded
ERROR:   Stack sizes: local: 0.7Gb, global: 0.2Gb, trail: 34.1Mb

While

?- reverse(X, [a,b]).
X = [b, a] ;
false.

:slight_smile:

3 Likes