Fork me on GitHub
#core-logic
<
2021-12-06
>
tschady00:12:05

How would you output the number of steps a logic program took to get the desired output? e.g. https://github.com/clojure/core.logic/wiki/Examples#a-classic-ai-program How can you find how many times moveo needs to be run for each success? Use trace-lvar ? log ? Or embed a counter as an lvar and inc it? (not sure how to do that)? Extend a basic logic function?

paulocuneo02:12:35

dunno, but thinking about it, for an "execution to succeed" it will have to execute the last goal from run, that means it reached a leaf, but the only thing that is threaded through all branches is the substitution map. I imagine trying to hack the substitution in core.logic to count the times it makes a unification, but that's not exactly how many goals/relation have been executed

paulocuneo02:12:03

also you could hack the substitution to count how many times it executed bind , that is how many relations the substitution has executed

Ben Sless16:12:55

Add trace binding, conjo to it the name of the move taken