(conda & clauses)
Soft cut. Once the head of a clause has succeeded all other clauses will be ignored. Non-relational.
;; Mind the order:
(defn logic-test-1 []
(run* [q r]
(membero q ["linux" "windows" "mac" "android" ""])
(conda
[(membero q ["linux" "windows"]) (== r 1)]
[(== q "mac") (== r 2)]
[succeed (== q "") (== r 3)])))
;; => (["linux" 1] ["windows" 1] ["mac" 2] ["" 3])
;; conda takes ground values and matches them one by one against its clauses.
(defn logic-test-2 []
(run* [q r]
(conda
[(membero q ["linux" "windows"]) (== r 1)]
[(== q "mac") (== r 2)]
[succeed (== q "") (== r 3)])
(membero q ["linux" "windows" "mac" "android" ""])))
;; (["linux" 1] ["windows" 1])
;; conda takes a fresh variable and associates it to the head of its first clause.
;; only the rest of the first clause (== r 1) is considered