Question: Prolog Write a procedure filter (List,PredName,Result) that removes from L all the ele- ments x for which PredName (X) fails, and returns the resulting list
Prolog
Write a procedure filter (List,PredName,Result) that removes from L all the ele- ments x for which PredName (X) fails, and returns the resulting list in Result. The predcate PredName/1 should be defned when calling the procedure flter (6) The elements in List can be assumed to all be integers For example: let test be defined as test (N).-N >-o ?- filter(L-6,7,-1,0],test,L) Hint: Use the Prolog built-in predicate
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
