next up previous
Next: Global variables and DataBase Up: Obtaining More Solutions Previous: bagof or setof

Removing duplicate items with setof

Q: setof(Child, Age ^ age(Child,Age), ChildList), 
   setof(Age, Child ^ age(Child,Age), AgeList).

A: ChildList = [ anne, pat, peter, tom ]
   AgeList = [5, 7, 8]

Q: setof(Age/Child, age(Child,Age), List) 
A: List = [5/anne, 5/tom, 7/peter, 8/pat]



Omer F Rana
Thu Feb 20 20:05:17 GMT 1997