I have this code which does as I wish, it pulls the parents of the given person recursively:
(defn anc [child]
(run* [q]
(conde
[(fresh [?p]
(parento child ?p)
(?== q [child ?p]))]
[(fresh [?p ?gp]
(parento child ?p)
(parento ?p ?gp)
(?== q [ ?p ?gp]))]
[(fresh [?p ?gp ?ggp]
(parento child ?p)
(parento ?p ?gp)
(parento ?gp ?ggp)
(?== q [ ?gp ?ggp]))]
)))
The problem is that for each generation I go back, I have to add a new test.
Is there a way to generalize this in core.logic?