Phase 5: true laziness — lazy transformers + deadlined harness
jolt-c09 (partial, Steps 0–2d complete). Lazy combinator layer (Step 1): - lazy-cons: build a LazySeq cell from val + rest-thunk (phm.janet) - lazy-from: coerce any seqable to lazy view without forcing (core.janet) - core-seq: check ls-first emptiness, not ls-seq realization (core.janet) Lazy transformers (Steps 2a–2d): Converted in Janet core.janet (lazy branches preserving transducer arities): drop-while, interpose, distinct, partition, partition-all, keep, keep-indexed, map-indexed, take-nth Moved to Clojure overlay (jolt-core): interleave (20-coll.clj) — lazy multi-arity, matches Clojure mapcat (10-seq.clj) — transducer arity + standard (apply concat (apply map f colls)) Safety net (Step 0): test/support/lazy-eval.janet — subprocess worker for Clojure eval test/integration/lazy-infinite-test.janet — deadlined harness (os/spawn + 5s) Multi-input map/mapcat tests (Step 2d): sequences-spec.janet +9 tests, verified against Clojure/CLJS references Gates: lazy-infinite: 18/18 (mapcat on infinite inputs hangs — apply forces, needs Step 4) conformance: 229/229 ×3 (interpret/compile/self-host) specs: 32/32 files, 0 failures
This commit is contained in:
parent
f6bd22ae94
commit
e2e189acfe
7 changed files with 337 additions and 83 deletions
16
test/support/lazy-eval.janet
Normal file
16
test/support/lazy-eval.janet
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Worker: evaluate a Clojure equality check in a fresh Jolt ctx and print
|
||||
# @@RESULT true or @@RESULT false. Used by lazy-infinite-test under a wall-clock
|
||||
# deadline so infinite-seq hangs are caught as test failures.
|
||||
(use ../../src/jolt/api)
|
||||
(use ../../src/jolt/reader)
|
||||
|
||||
(def expected (get (dyn :args) 1))
|
||||
(def actual (get (dyn :args) 2))
|
||||
|
||||
(when (and expected actual)
|
||||
(def ctx (init {}))
|
||||
(def prog (string "(= " expected " " actual ")"))
|
||||
(def [ok val] (protect (eval-string ctx prog)))
|
||||
(if ok
|
||||
(printf "@@RESULT %q" val)
|
||||
(printf "@@ERROR %q" val)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue