Question: Prolog Facts and Rules Example 3 In example3.pl, write a set of prolog facts and rules called reverseList that reverses a given list. The given
Prolog Facts and Rules Example 3
In example3.pl, write a set of prolog facts and rules called reverseList that reverses a given list. The given list must be the first argument and the reversed list must be the third. You may use merge rule as part of this answer.
Eg: reverseList(List, ReversedList)
Your code should produce the following results:
?- reverseList([1,2,3], X).
X = [3,2,1].
?- reverseList([1], X).
X = [1].
?- reverseList([], X).
X = [].
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
