Wednesday, February 21, 2024

Reverse a list.

 

Reverse a list.

my_reverse(L1,L2) :- my_rev(L1,L2,[]).


my_rev([],L2,L2) :- !.

my_rev([X|Xs],L2,Acc) :- my_rev(Xs,L2,[X|Acc]).



No comments:

Post a Comment