= Solution
A matching mother or father field identifies a child. In <Haskell>:
``
children :: Database -> Person -> [Person]
children db p = unique [baby | (baby,mother,father) <- db,
mother == p || father == p]
``
<Duplicate removal> handles repeated certificates and children recorded in more than one matching row. Thus
$$
\boxed{\operatorname{children}(db,p)=\{c\mid(c,m,f)\in db,\ m=p\ \lor\ f=p\}.}
$$
The displayed <set> describes membership; the implementation returns its entries as a <list> in first certificate order.
Back to article page