core-logic

tschady 2021-12-06T00:42:05.037500Z

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?

paulocuneo 2021-12-06T02:28:35.037600Z

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

paulocuneo 2021-12-06T02:35:03.038Z

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

Ben Sless 2021-12-06T16:15:55.038300Z

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