mk: phase 5B — project, escape into host SX
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 56s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 56s
(project (vars ...) goal ...) defmacro walks each named var via mk-walk*, rebinds them in the body's lexical scope, then mk-conjs the body goals on the same substitution. Hygienic — gensym'd s-param so user vars survive. Lets you reach into host SX for arithmetic, string ops, anything that needs a ground value: (project (n) (== q (* n n))), (project (s) (== q (str s \"!\"))), and so on. 6 new tests, 194/194 cumulative.
This commit is contained in:
@@ -120,8 +120,9 @@ Key semantic mappings:
|
||||
`tests/relations.sx`; reverseo/flatteno/permuteo/lengtho deferred)
|
||||
|
||||
### Phase 5 — `project` + `matche` + negation
|
||||
- [ ] `project` `(x ...) body` — access reified values of logic vars inside a goal;
|
||||
escapes to ground values for arithmetic or string ops
|
||||
- [x] `project` `(x ...) body` — defmacro: rebinds named vars to `(mk-walk* var s)`
|
||||
in the body's lexical scope, then runs `(mk-conj body...)` on the same
|
||||
substitution. Hygienic via gensym'd `s`-param. (`Phase 5 piece B`)
|
||||
- [ ] `matche` — pattern matching over logic terms (extension from core.logic)
|
||||
`(matche l ((head . tail) goal) (() goal))`
|
||||
- [x] `conda` — soft-cut: first non-failing head wins; ALL of head's answers
|
||||
@@ -156,6 +157,10 @@ _(none yet)_
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **2026-05-07** — **Phase 5 piece B — project**: `lib/minikanren/project.sx` —
|
||||
defmacro that walks each named var, rebinds them, and runs the body's mk-conj.
|
||||
Demonstrated escape into host arithmetic / string ops (`(* n n)`, `(str s "!")`).
|
||||
Hygienic gensym'd s-param. 6 new tests, 194/194 cumulative.
|
||||
- **2026-05-07** — **Peano arithmetic** (`lib/minikanren/peano.sx`): zeroo, pluso,
|
||||
minuso, lteo, lto, *o on Peano-encoded naturals (`:z` / `(:s n)`). pluso runs
|
||||
forward, backward, and enumerates: `(run* q (fresh (a b) (pluso a b 3)
|
||||
|
||||
Reference in New Issue
Block a user