mk: defrel — Prolog-style relation-definition macro
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
(defrel (NAME ARGS...) (CLAUSE1 ...) (CLAUSE2 ...) ...) expands to (define NAME (fn (ARGS...) (conde (CLAUSE1 ...) (CLAUSE2 ...) ...))). Mirrors Prolog's `name(Args) :- goals.` shape. Inherits the Zzz-on-each- clause laziness from conde, so user relations defined via defrel terminate on partial answers without needing manual delay. Tests redefine membero / listo / pluso through defrel and verify equivalence. 3 new tests, 347/347 cumulative.
This commit is contained in:
@@ -173,6 +173,11 @@ _(none yet)_
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **2026-05-08** — **defrel — Prolog-style relation definition macro**:
|
||||
`(defrel (NAME ARGS...) (CLAUSE1 ...) (CLAUSE2 ...) ...)` expands to
|
||||
`(define NAME (fn (ARGS...) (conde (CLAUSE1 ...) (CLAUSE2 ...) ...)))`.
|
||||
Mirrors Prolog's clause syntax and inherits Zzz-via-conde so recursive
|
||||
relations terminate. 3 new tests, 347/347 cumulative.
|
||||
- **2026-05-08** — **lasto / init-o**: classic head/tail-style list relations.
|
||||
lasto extracts the final element; init-o extracts everything-but-the-last.
|
||||
Together with appendo, the round-trip `init ⊕ (last) = l` holds. 8 new
|
||||
|
||||
Reference in New Issue
Block a user