Question: PROLOG without any pre-defined predicates! Write a Prolog rule for the predicate elimdup(L1,L2), which eliminates duplicate elements from a list. L1 is a given list

PROLOG without any pre-defined predicates!

Write a Prolog rule for the predicate elimdup(L1,L2), which eliminates duplicate elements from a list. L1 is a given list of elements, and L2 is used to store the result.

Example

: ?- elimdup([1, 3, 5, 3], R).

yes, R = [1,3,5]

//must be in this order.

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!