Question: Question 3 [13] (a) Write a procedure filter (L,PredName, L1,L2) that accepts a list L and returns two lists L1 and L2, where L1 contains

 Question 3 [13] (a) Write a procedure filter (L,PredName, L1,L2) that

Question 3 [13] (a) Write a procedure filter (L,PredName, L1,L2) that accepts a list L and returns two lists L1 and L2, where L1 contains all elements in L for which PredName(x) fails, and L2 contains all elements in L for which PredName (x) succeeds. The predicate PredName/1 should be defined when calling the procedure filter. For example: let test be defined as test(N).- N > 0. ?- filter((-6,7,-1,0], test, L1,L2). L1 = [-6, -1] L2 = [7, 0] NB Use the Prolog built-in predicate (6) (b) Write a Prolog program to remove duplicate elements from an unsorted list without using the built-in predicate setof (4) (c) Write a Prolog program to remove duplicate elements from a list, this time using the built-in predicate setof (3)

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!