Hi, I don't understand how this programm works.
reverse_list([], []).
reverse_list([Head | Tail], ReversedList) :-
reverse_list(Tail, ReversedTail),
append(ReversedTail, [Head], ReversedList).
It is assumed to reverse a list, but I don't know what calls does it make and with what order. Can anyone help me? I tried to run it on Swi-Prolog, but it didn' t help me. Thank you.
reverse_list([], []).
reverse_list([Head | Tail], ReversedList) :-
reverse_list(Tail, ReversedTail),
append(ReversedTail, [Head], ReversedList).
It is assumed to reverse a list, but I don't know what calls does it make and with what order. Can anyone help me? I tried to run it on Swi-Prolog, but it didn' t help me. Thank you.