I am trying to understand how a tabled goal works in core.logic?
can it be used to eliminate circular references in for example a graph traversal for example
or is it supposed to eliminate duplicates in the result
I have a logic expression as such - which traverses a child hierarchy. CHD stands for Child relation and RN stands for narrow relation
Issue is - it can go into endless loop if there are circular references
I think it is more like a performance optimization, if you have a goal that diverges it won't stop it from diverging
there is a correspondence between proof by induction and recursion, they both need a base case
you might be able to get by using one of the non-relational variants of conde
maybe conda
or make the clauses in your conde mutually exclusive
Thank you @hiredman - as always your responses are very helpful
just so I follow what you're saying - "divergence" means there is a cycle right?
it could be caused by cycle in something you are are traversing recursively, my very rough understanding of it is divergence == infinitely looping logic program
by making the clauses mutually exclusive - do you mean adding something like !=
sorry if this is a very stupid question 🙂 - still learning the ropes of core.logic
It is very interesting - at the same time very difficult to wrap your head around
yeah, != or some other goal that will fail on the one branch if the other branch is the one you want
Ah - Thank you - I will try that
I was wrong about tabling: https://github.com/clojure/core.logic/wiki/Features#tabling the docs say it will turn a non-terminating logic program in to a terminating one
that was what I thought it was supposed to do - but still I see it is diverging - maybe I need to table only the recursive portion