Question: prolog programming % problem 3 (recursion with lists) % Implement compare(L1, L2) that returns true iff the elements of % list Ll match (in the

prolog programming prolog programming % problem 3 (recursion with lists) % Implement compare(L1, L2)

% 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!