Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
conde.sx is a single defmacro: (conde (g1a g1b ...) (g2a g2b ...) ...) folds to (mk-disj (mk-conj g1a g1b ...) (mk-conj g2a g2b ...) ...). 9 tests cover single/multi-clause, mixed success/failure, conjunction inside clauses, fresh+disj inside a clause, nesting, and all-fail / no-clauses. 100/100 cumulative.
21 lines
619 B
Plaintext
21 lines
619 B
Plaintext
;; lib/minikanren/conde.sx — Phase 2 piece C: `conde`, the canonical
|
|
;; miniKanren and-or form.
|
|
;;
|
|
;; (conde (g1a g1b ...) (g2a g2b ...) ...)
|
|
;; ≡ (mk-disj (mk-conj g1a g1b ...)
|
|
;; (mk-conj g2a g2b ...) ...)
|
|
;;
|
|
;; Each clause is a list of goals, conj'd internally; clauses are disj'd
|
|
;; among one another (interleaved via mk-mplus, so left-recursive
|
|
;; relations don't starve the right-hand clauses).
|
|
|
|
(defmacro
|
|
conde
|
|
(&rest clauses)
|
|
(quasiquote
|
|
(mk-disj
|
|
(splice-unquote
|
|
(map
|
|
(fn (clause) (quasiquote (mk-conj (splice-unquote clause))))
|
|
clauses)))))
|