Question: Prolog % problem 3 (recursion with lists) % Implement double(L1, L2) that returns true iff every element of % list L1 is doubled in list

Prolog

% problem 3 (recursion with lists)

% Implement double(L1, L2) that returns true iff every element of % list L1 is doubled in list L2. See the test cases below. % Assume that the elements of L1 are atoms (not lists). % Implement using RECURSION! Otherwise, points will be deducted.

% Test cases: % ?- double([a],[a, a]). % true. % ?- double([a, b],[a, a, b, b]). % true. % ?- double([a, b],[a, a, b, c]). % false. % ?- double([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!