core: jolt-vzm — every? short-circuits lazily (boundary audit)
Audited all 43 realize-for-iteration call sites. Result: every? was the one transformer-style leak — it realized the whole coll before iterating, so (every? pos? (range)) hung instead of short-circuiting on the first false (Clojure short-circuits). Now walks lazy input cell-by-cell via realize-ls and stops at the first false; not-every? inherits the fix. Everything else is a legitimate realization boundary (reverse/sort/into/vec/set/ list/str-join/doall/apply/transient/to-array/hash-*/shuffle/rand-nth — must see all elements) or forces only finite/concrete input (drop-while's eager branch, cycle's seed, nth's concrete branch). some is already lazy (overlay). realized? reads the :realized flag without forcing. first/nth/take pull only as far as needed. Regression: deadlined (every?/not-every? pos? (range)) cases — would hang if the leak returned. Gate: conformance 249x3, lazy-infinite 42/42, fixpoint, self-host, specs+unit green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c78587bfc3
commit
da2b065f46
2 changed files with 22 additions and 4 deletions
|
|
@ -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))"]
|
||||
["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)))"]
|
||||
["take 3 partition-all 2 range" "(quote ((0 1) (2 3) (4 5)))" "(take 3 (partition-all 2 (range)))"]
|
||||
["take 3 map-indexed vector range" "(quote ([0 0] [1 1] [2 2]))" "(take 3 (map-indexed vector (range)))"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue