问题描述
我试图在clojure中使用mini-kanren的实现。但一直在努力理解cond-a cond-u和cond-e之间的区别。我似乎很清楚cond-e,但对cond-a和cond-u的理解是安静的。
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需要一组目标,然后尝试每个人...即尝试所有成功的分支。
cond-e takes a set of goals and then tries each of them... i.e tries all the branches that succeed.
cond-a和cond-u相反地提交到第一个谓词成功的分支,cond-a返回所有可能的成功的统一。而cond-u只返回第一个成功的统一...但是,似乎这种理解是不正确的,当我使用它。
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.
推荐答案
cond-e提供所有成功分支的每一个答案
cond-e gives every answer from all branches that succeed
cond-i给出每个答案,但交错它们。
cond-i gives every answer but interleaves them.
cond-a只提供第一个成功分支的答案
cond-a only gives the answers from the first successful branch
cond-u只提供第一个成功分支的第一个答案
cond-u only gives the first answer from the first successful branch
这篇关于mini-kanren cond-a cond-u和cond-e之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!