Fork me on GitHub
#core-logic
<
2019-07-25
>
javazquez22:07:12

Hi everyone, I just started digging into core.logic and trying to wrap my brain around it. I created a family tree that looks like the following (def facts (pldb/db [parento :james :jerry] [parento :jerry :jordan] [parento :jerry :richard] [parento :jerry :harry] [parento :jerry :jackson] [parento :george :james])) Jerry has multiple kiddos and George is the great grand father to jordan, richard, harry and jackson. I have been struggling to write code that given one of these children, would produce all the ancestors without dups ex. given :jackson return jerry, james, george any help would be greatly appreciated 🙂

hiredman22:07:55

something of the form (defn accesto [foo q] (l/conde [(parento q foo)][(l/fresh [x] (parento q x) (parento x foo))])) but I haven't really used pldb and I am pretty rusty

hiredman22:07:38

but unique results can be difficult to achieve, just because of the iterative way queries run

javazquez23:07:38

Out of curiosity and learning, would you model the data differently?