mk: samelengtho — equal-length relation
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s

Recurses positionally, dropping a head from each list each step. Both
arguments can be unbound, giving the natural enumeration:

  (run 3 q (fresh (l1 l2) (samelengtho l1 l2) (== q (list l1 l2))))
    -> (((), ())                         empty/empty
        ((_.0), (_.1))                   pair of 1-element lists
        ((_.0 _.1), (_.2 _.3)))          pair of 2-element lists

5 new tests, 293/293 cumulative.
This commit is contained in:
2026-05-08 11:09:48 +00:00
parent 186171fec3
commit cfb43a3cdf
3 changed files with 51 additions and 1 deletions

View File

@@ -173,6 +173,11 @@ _(none yet)_
_Newest first._
- **2026-05-08** — **samelengtho**: classic miniKanren relation that
succeeds when two lists have equal length. Symmetric — works to enumerate
both lists fresh: `(run 3 q (fresh (l1 l2) (samelengtho l1 l2) (== q
(list l1 l2))))` produces empty/empty, then 1-elem pairs, then 2-elem.
5 new tests, 293/293 cumulative.
- **2026-05-08** — **Pythagorean triples (intarith showcase)**: search for
(a, b, c) ∈ [1..10]³, a ≤ b, a² + b² = c² via `ino + lteo-i + *o-i +
pluso-i + ==`. Finds exactly `(3 4 5)` and `(6 8 10)`. Demonstrates the