mk: lasto + init-o — last and not-last list relations
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 52s

lasto: x is the final element of l. Direct base case (l = (x)) plus
recurse-on-cdr.

init-o: init is l without its last element. Base case for singleton:
(== init ()). Otherwise recurse, threading the head through to the
init result via conso.

Together with appendo, the round-trip init append (list last) = l
holds, which is exercised by an end-to-end test.

8 new tests, 344/344 cumulative.
This commit is contained in:
2026-05-08 11:25:12 +00:00
parent 48835f2d4f
commit 99066430fd
3 changed files with 58 additions and 0 deletions

View File

@@ -173,6 +173,10 @@ _(none yet)_
_Newest first._
- **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
tests, 344/344 cumulative.
- **2026-05-08** — **Datalog-style relational database queries**: tests/rdb.sx
shows miniKanren as a query engine over fact tables. Defines two tables
(employees + project assignments), wraps each with a relation that does