domains
list=integer*
predicates
reverse_list(list,list)
reverse(list,list,list)
clauses
reverse_list(Inputlist,Outputlist):-
reverse(Inputlist,[],Outputlist).
reverse([],Outputlist,Outputlist).
reverse([Head|Tail],List1,List2):-
reverse(Tail,[Head|List1],List2).
Output :
Goal: reverse_list([1,2,
3],X)
X=[3,2,1]
1 Solution
Goal: