core: Stage 3 — leaf batch 3: empty/assoc-in/update-in + interpose/take-nth to the overlay

empty, assoc-in, and update-in move to 20-coll.clj as the canonical recursive
ports; interpose and take-nth move to the lazy tier WITH their canonical
transducer arities (volatile-based), so the seed's td-interpose/td-take-nth
helpers go too. (empty lazy-seq) is () now — the kernel fn returned a bare
host table for it.

keys/vals/empty? stay put for now: they're expander-coupled — 00-syntax's
when/and/or/cond/destructure expanders call them at expansion time, which
happens during the kernel-tier compile, before any later tier exists. They
move when early defns get the staged-recompile treatment macros already have.

26 new spec rows (incl. transducer arities through sequence/into and laziness
checks against (range)). Gate green: conformance 326x3, suite >= baseline,
full jpm test.
This commit is contained in:
Yogthos 2026-06-10 15:26:41 -04:00
parent 1340b7c52f
commit 780b6474ff
4 changed files with 107 additions and 64 deletions

View file

@ -138,3 +138,40 @@
(when (seq s)
(cons (take n s) (go (nthrest s step))))))]
(go coll))))
;; --- Phase 2 leaf batch 3 (jolt-ded): canonical lazy + transducer arities ----
(defn interpose
([sep]
(fn [rf]
(let [started (volatile! false)]
(fn
([] (rf))
([result] (rf result))
([result input]
(if (deref started)
(let [sepr (rf result sep)]
(if (reduced? sepr)
sepr
(rf sepr input)))
(do (vreset! started true)
(rf result input))))))))
([sep coll]
(drop 1 (interleave (repeat sep) coll))))
(defn take-nth
([n]
(fn [rf]
(let [iv (volatile! -1)]
(fn
([] (rf))
([result] (rf result))
([result input]
(let [i (vswap! iv inc)]
(if (zero? (rem i n))
(rf result input)
result)))))))
([n coll]
(lazy-seq
(when-let [s (seq coll)]
(cons (first s) (take-nth n (drop n s)))))))