jolt/jolt-core/clojure/core
Yogthos 297d92fbb8 core: fix jolt-r81 at root — move lazy-seq/lazy-cat to the early syntax tier
Root cause: lazy-seq/lazy-cat were defined in 30-macros, which loads AFTER the
seq/coll tiers (10-seq, 20-coll) that use them. In compile mode a tier's forms
are compiled as the tier loads, so (lazy-seq …) in those tiers was compiled when
lazy-seq was not yet a registered macro — i.e. as a CALL to the macro-as-function,
which at runtime returns its own expansion `(make-lazy-seq (fn* [] …))` as data.
That leaked form then flowed into ops like `odd?` (partition-by) → type errors,
or silently produced wrong structure. Interpret/self-host masked it (expand at
call time); the eager fallbacks and the earlier letfn versions masked it by
falling back to the interpreter.

Fix: define lazy-seq/lazy-cat in 00-syntax (loaded first), exactly as when-let
already is for the same reason. They use only seed fns (make-lazy-seq/coll->cells/
concat) + map. With the macro registered early, the seq/coll tiers compile
(lazy-seq …) correctly.

With the root fixed, interleave/reductions/tree-seq drop their letfn workarounds
and use the canonical recursive Clojure forms (top-level / fn-self-name recursion
inside lazy-seq), verified leak-free in compile mode with strict probes.

Regression guards added: partition-by with odd? (the strict pred that exposed the
leak; the prior case used identity which masked it), reductions over an infinite
range, tree-seq summed through a strict filter — all ×3 modes.

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

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 17:47:52 -04:00
..
00-kernel.clj core: staged-bootstrap kernel tier; move second/peek/subvec/mapv/update to Clojure 2026-06-06 13:15:17 -04:00
00-syntax.clj core: fix jolt-r81 at root — move lazy-seq/lazy-cat to the early syntax tier 2026-06-08 17:47:52 -04:00
10-seq.clj Review fixes: revert partition+concat overlay, delete dead defns, dedupe de-duplicated 2026-06-08 12:04:48 -04:00
20-coll.clj core: fix jolt-r81 at root — move lazy-seq/lazy-cat to the early syntax tier 2026-06-08 17:47:52 -04:00
30-macros.clj core: fix jolt-r81 at root — move lazy-seq/lazy-cat to the early syntax tier 2026-06-08 17:47:52 -04:00
40-lazy.clj Review fixes: partition+concat in 10-seq, delete dead defns, dedupe de-duplicated 2026-06-08 11:58:39 -04:00
MIGRATION.md migration doc: phase 3 status + the hot-macro expansion-speed finding 2026-06-07 08:47:04 -04:00