Question

I have tried to use an implementation of mini-kanren in clojure. But been struggling to understand the difference between cond-a cond-u and cond-e. I seem to be quite clear about cond-e but understanding of cond-a and cond-u is quiet bad.

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

cond-a and cond-u on the contrary commit to the branch whose first predicate succeeds and cond-a returns all the possible successful unifications there after. while cond-u returns only the first successfull unification ... but however it seems like this understanding is not correct when I use it. Can somebody help me clarify this understanding.

Was it helpful?

Solution

cond-e gives every answer from all branches that succeed

cond-i gives every answer but interleaves them.

cond-a only gives the answers from the first successful branch

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

OTHER TIPS

I was just trying to get my head around these matters. There's a shortified scheme implementation Sokuza-kanren with a few comments, I'll read it tonight.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top