Question: prolog programming % problem 3 (recursion with lists) % Implement compare(L1, L2) that returns true iff the elements of % list Ll match (in the
% problem 3 (recursion with lists) % Implement compare(L1, L2) that returns true iff the elements of % list Ll match (in the same order) the elements of list L2. % Assume that the elements of Li are atoms (not lists). % Implement using recursion. % Test cases: % ? - compare([], []). % true. % ? - compare([_, []). % false. % ?- compare([a, b, c, d], [a, b, c, d]). % true. % ?- compare([a, b, c), [c, b, a]). % false. % ?- compare([a, b], [a, b, c]). % false. % write your solution here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
