core: jolt-b56 — lazy sequence (the laziness-coupled straggler)

(sequence xform coll) was eager (transduce into a tuple), so it hung on infinite
input. Now it's a lazy buffered transducer pump: pulls one source element at a
time, pushes it through the transducer's reducing fn into a buffer, and emits
buffered outputs lazily — so (take 3 (sequence (map inc) (range))) works.
Honors `reduced` (early stop) and runs the completion arity to flush stateful
transducers. Normalizes the source via core-seq (walking a raw pvec/set would
misfire — seq-done? uses length, which counts a pvec table's keys).

The other jolt-b56 items stay native by design: sequential?/seqable? are
representation-coupled and representation-mode-sensitive (jolt-1vx); realized?
reads the tagged :realized flag; cat/eduction/transduce/halt-when/unreduced/
ensure-reduced are the transducer/Reduced kernel the issue says to keep native.

Note: partition-all has no transducer (1-arg) arity, so (sequence (partition-all
2) …) errors — a pre-existing gap, unrelated to this change.

Gate: conformance 249x3, lazy-infinite 44/44, fixpoint, self-host, specs+unit green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yogthos 2026-06-08 18:00:05 -04:00
parent da2b065f46
commit c7378f4be0
2 changed files with 40 additions and 2 deletions

View file

@ -50,6 +50,8 @@
["take 4 interleave range iterate" "(quote (0 10 1 11))" "(take 4 (interleave (range) (iterate inc 10)))"]
["take 4 reductions + range" "(quote (0 1 3 6))" "(take 4 (reductions + (range)))"]
["take 3 tree-seq infinite" "(quote (0 0 0))" "(take 3 (tree-seq (fn [_] true) (fn [n] [n]) 0))"]
["sequence xform lazy inf" "(quote (1 2 3))" "(take 3 (sequence (map inc) (range)))"]
["sequence comp xform inf" "(quote (2 4 6))" "(take 3 (sequence (comp (filter odd?) (map inc)) (range)))"]
["every? short-circuits on inf" "false" "(every? pos? (range))"]
["not-every? short-circuits on inf" "true" "(not-every? pos? (range))"]
["take 3 partition 2 range" "(quote ((0 1) (2 3) (4 5)))" "(take 3 (partition 2 (range)))"]