mk: phase 2D — condu + onceo, phase 2 complete
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 52s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 52s
condu.sx: defmacro `condu` folds clauses through a runtime `condu-try` walker. First clause whose head yields a non-empty stream commits its single first answer; later clauses are not tried. `onceo` is the simpler sibling — stream-take 1 over a goal's output. 10 tests cover: onceo trimming success/failure/conde, condu first-clause wins, condu skips failing heads, condu commits-and-cannot-backtrack to later clauses if the rest of the chosen clause fails. 110/110 cumulative. Phase 2 complete.
This commit is contained in:
@@ -79,9 +79,11 @@ Key semantic mappings:
|
||||
wraps each clause body in `mk-conj` and folds via `mk-disj`. Notes:
|
||||
with eager streams ordering is left-clause-first DFS; true interleaving
|
||||
requires paused thunks (Phase 4 recursive relations).
|
||||
- [ ] `condu` — committed choice (soft-cut)
|
||||
- [ ] `onceo` — succeeds at most once
|
||||
- [ ] Tests: basic goal composition, backtracking, interleaving
|
||||
- [x] `condu` — committed choice. defmacro folding clauses into a runtime
|
||||
`condu-try` walker; first clause whose head goal yields a non-empty
|
||||
stream commits its first answer, rest-goals run on that single subst.
|
||||
- [x] `onceo` — `(stream-take 1 (g s))`; trims a goal's stream to ≤1 answer.
|
||||
- [x] Tests: basic goal composition, backtracking, interleaving (110 cumulative)
|
||||
|
||||
### Phase 3 — run + reification
|
||||
- [ ] `run*` `goal` → list of all answers (reified)
|
||||
@@ -146,6 +148,10 @@ _(none yet)_
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **2026-05-07** — **Phase 2 piece D + done** (`condu` / `onceo`): `lib/minikanren/condu.sx`.
|
||||
Both are commitment forms: `onceo` is `(stream-take 1 ...)`; `condu` walks clauses
|
||||
and commits the first one whose head produces an answer. 10 tests in `tests/condu.sx`,
|
||||
110/110 cumulative. Phase 2 complete — ready for Phase 3 (run + reification).
|
||||
- **2026-05-07** — **Phase 2 piece C** (`conde`): `lib/minikanren/conde.sx` — single
|
||||
defmacro folding clauses through `mk-disj` with internal `mk-conj`. 9 tests in
|
||||
`tests/conde.sx`, 100/100 cumulative. Confirmed eager DFS ordering for ==-only
|
||||
|
||||
Reference in New Issue
Block a user