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](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f315ee5c44d_89366f315edc9dc3.jpg)
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
Get step-by-step solutions from verified subject matter experts
