core-logic

javazquez 2019-07-25T22:41:12.004800Z

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 🙂

2019-07-25T22:55:55.007100Z

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

2019-07-25T22:57:38.008100Z

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

javazquez 2019-07-25T22:59:26.008400Z

i see

javazquez 2019-07-25T22:59:29.008600Z

ok

javazquez 2019-07-25T22:59:34.008800Z

Thank you!

javazquez 2019-07-25T23:28:38.010300Z

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

2019-07-25T23:44:25.010600Z

nope