consider the following geneaology,
mark has three children, mary, crystal, and sam,
mary has three children, frank, amber, and john,
amber and john do no have children,
frank has three children, jonathan, bob and robert,
bob has one child, maggie,
jonathan, robert, and Maggie do not have children,
crystal has two children, tom and sally,
tom has two children, tom jr. and david,
tom jr. and david do not have children.
sally has three children, erica, Jennifer, and keith,
jennifer has one child, kyle,
erica, keith, and kyle do not have children.
sam has one child, eric, and eric has one child, suzy,
suzy has no children.
the challenge was to write a shen list program in a declarative way
to find a grandparent-grandchild relation for some or all of the
members in the database.
this is typical of relational database example via geneaology in prolog,
but shen list can do it too, superbly so, including (findall), which is an
icing on the cake, (findall) can find grandparent-grandchild relation for all
applicable members in the database, or any random point on the geneaology
can be picked as the starting point, all in 20 lines of code, not counting db,
the database is flexible and modifiable, adding/deleting new and old data.
all in all it was fun and easy and though frustrating when dealing with typos
and missing bracks, when it works it's like magic!