Mini-kanren, what is the difference between cond-cond-u and cond-e?

I tried using mini-kanren implementation in clojure. But he was trying to understand the difference between cond-cond-u and cond-e. I seem to be very clear about cond-e, but understanding cond-a and cond-u is very poor.

cond-e takes a set of goals and then tries each of them ... i.e. tries all branches that succeed.

cond-a and cond-u, on the contrary, pass to the branch whose first predicate succeeds, and cond-a returns all possible successful joins there after. while cond-u only returns the first successful unification ... but this seems to be wrong when I use it. Can someone help me clarify this understanding.

+2
source share
2 answers

cond-e gives every answer from all branches that succeed

cond-i gives each answer, but alternates them.

cond-a gives answers only from the first successful branch

cond-u gives only the first answer from the first successful branch

+2
source

I was just trying to solve these questions. It implements a Sokuza-kanren short circuit diagram with a few comments, I will read it tonight.

+2
source

Source: https://habr.com/ru/post/1401172/


All Articles