2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/documents/Programmierparadigmen/scripts/prolog/reverse-list.pl

5 lines
111 B
Perl
Raw Normal View History

2014-04-05 18:18:47 +02:00
rev([], []).
rev([X|Xs], Ys) :- rev(Xs, Zs), append(Zs, [X], Ys).
?- rev([1,2,3,4,5], L).
L = [5, 4, 3, 2, 1].