--PRACTICE QUESTIONS-- TA: Haluk Madencioglu 1-) i) Define a predicate setdiff/3 such that ; given two sets A,B, and a third C, setdiff(A,B,C) will be true if C is the set difference of A and B For example: setdiff([a,b,c,d,e],[b,c],L) gives L=[a,d,e] Hint: use member predicate. You must get the exact set difference and for once. Consider using a cut. ii) When does the query fail for any set? Does it produce any multiple solutions for any query? which one? 2-) Define a predicate flatlist/2 which generates a flat list from a nested one. Sample use: given [a, [b,c], [d, e, [f, [g], h] ] ], flatlist([a, [b,c], [d, e, [f, [g], h] ] ],L) gives L=[a,b,c,d,e,f,g,h] You can use append. 3-)Do flatlist using difference lists.