简体   繁体   中英

Clojure: core.logic, conde, run 1

Context

According to the core.logic documentation, conde is really condi, which means it might not return in the same order as mini-kanren.

Question

Thus, if I have something of the form:

(run 1 [q]
  (conde ...))

Is it possible that core.logic / mini-kanren will give me different results because:

  • the conde can return the results in different order
  • run 1 only takes one of them, thus the two could have different first elements

Thanks!

Yes it's possible. conde makes no guarantee on the answers order (it's very much implementation dependent and doesn't matter since all alternatives are explored in parallel).

While playing with core.logic it bites me at multiple times since the unit tests are assuming a specific order.

AFAIK, in the Reasoned Schemer 2nd edition, conde will be the 1st edition condi .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM