This is NOT homework - the solution is already in the text. I just did not understand the solution.
Problem
(run* (q) (let [a (== true q) b (== false q)] b))
The right decision
(false)
My convinced decision
()
My confusion
Apparently, the string "a (== true q)" is NOT executed, since the target is only b. It bothers me. My mental model so far for logical programming has been:
- consider all possible assignments q
display those that manage to go through the entire program
Thus, "a (== true q)" forces q = true, which makes it impossible to execute the string "b (== false q)".
However, apparently, only the “fabrications necessary to calculate the goal” are fulfilled. What's happening? What is the right mental execution model for core.logic / mini-kanren?
thanks
(By the way, I'm clearly mistaken, since mini-karen + core.logic agre with each other - I just want to understand what I'm doing wrong.)
user1311390
source share