From 53a189541cbef5bf3d6cd9529589e247707b5248 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Sat, 20 Jun 2026 19:40:05 -0400 Subject: [PATCH] Chez parity: realized? on lazy-seq + conj! 1-arity identity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit realized? threw 'not supported on' for a jolt-lazyseq record (the overlay reads :jolt/type); add a jolt-lazyseq? arm to the post-prelude wrapper reading the record's own realized? flag. conj! 1-arity (conj! coll) is the transducer-completion arity and returns coll as-is on the JVM, no transient check — we threw 'not a transient'. Both gates: zero-janet 2696->2698, prelude 2649->2652, 0 new divergences. --- host/chez/post-prelude.ss | 9 ++++++--- host/chez/transients.ss | 12 ++++++++---- test/chez/run-corpus-prelude.janet | 5 +++-- test/chez/run-corpus-zero-janet.janet | 9 +++++++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/host/chez/post-prelude.ss b/host/chez/post-prelude.ss index ad23bc2..23d60f5 100644 --- a/host/chez/post-prelude.ss +++ b/host/chez/post-prelude.ss @@ -62,9 +62,12 @@ (let ((overlay-realized? (var-deref "clojure.core" "realized?"))) (def-var! "clojure.core" "realized?" (lambda (x) - (if (or (jolt-future? x) (jolt-promise? x) (jolt-delay? x)) - (jolt-conc-realized? x) - (jolt-invoke overlay-realized? x))))) + (cond + ((or (jolt-future? x) (jolt-promise? x) (jolt-delay? x)) (jolt-conc-realized? x)) + ;; a lazy-seq carries its own realized? flag (lazy-bridge.ss). The overlay + ;; realized? reads :jolt/type and throws on a jolt-lazyseq record. + ((jolt-lazyseq? x) (jolt-lazyseq-realized? x)) + (else (jolt-invoke overlay-realized? x)))))) ;; clojure.edn/read over a reader: the overlay edn.clj drain-reader uses janet/type; ;; the native Chez version (io.ss) drains the jhost reader instead (jolt-uicd/jolt-7t3l). (def-var! "clojure.edn" "read" diff --git a/host/chez/transients.ss b/host/chez/transients.ss index 0af3efd..0d6faea 100644 --- a/host/chez/transients.ss +++ b/host/chez/transients.ss @@ -23,14 +23,18 @@ (jolt-transient-active-set! t #f) (jolt-transient-coll t)) -;; (conj!) with no args -> a fresh transient vector (Clojure); otherwise mutate t. +;; (conj!) with no args -> a fresh transient vector (Clojure); (conj! coll) is the +;; 1-arity transducer-completion arity, which returns coll as-is with NO transient +;; check (JVM: conj! 1-arity is identity); otherwise mutate t. (define (jolt-conj! . args) - (if (null? args) - (jolt-transient-new (jolt-vector)) + (cond + ((null? args) (jolt-transient-new (jolt-vector))) + ((null? (cdr args)) (car args)) + (else (let ((t (car args)) (xs (cdr args))) (jolt-trans-check t "conj!") (jolt-transient-coll-set! t (apply jolt-conj (jolt-transient-coll t) xs)) - t))) + t)))) ;; (assoc! t k v & kvs): variadic like Clojure (jolt-assoc already folds pairs). (define (jolt-assoc! t . kvs) (jolt-trans-check t "assoc!") diff --git a/test/chez/run-corpus-prelude.janet b/test/chez/run-corpus-prelude.janet index 9e12926..4c0ef21 100644 --- a/test/chez/run-corpus-prelude.janet +++ b/test/chez/run-corpus-prelude.janet @@ -322,8 +322,9 @@ # jolt-cf1q.7 parity batches (hash/rseq/cat/transient-as-fn + ns runtime fns + # runtime-require alias registration) -> 2590; arrays + reader-features/ # macroexpand/reader-conditional/re-matcher -> 2629; delay/force/realized? -> 2641. -# Strided runs scale down. -(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "2648"))) +# STM stub + portable line-seq -> 2649; realized? on a lazy-seq + conj! 1-arity +# (transducer-completion identity) -> 2652. Strided runs scale down. +(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "2652"))) (def floor (if (os/getenv "JOLT_CORPUS_LIMIT") 0 base-floor)) (when (or (> (length diverged) 0) (< pass floor)) (printf "REGRESSION: pass %d < floor %d or %d new divergence(s)" pass floor (length diverged))) diff --git a/test/chez/run-corpus-zero-janet.janet b/test/chez/run-corpus-zero-janet.janet index 4078ce6..4280871 100644 --- a/test/chez/run-corpus-zero-janet.janet +++ b/test/chez/run-corpus-zero-janet.janet @@ -200,6 +200,10 @@ (each k (sort-by (fn [k] (- (get tbl k))) (keys tbl)) (printf " %4d x %s" (get tbl k) k)))) (report "crash reasons" crash-keys) +(when (os/getenv "JOLT_DUMP_CRASH_LABELS") + (printf "\nCRASH LABELS:") + (each [l k] (sort-by (fn [pair] (get pair 1)) crashes) + (printf " [%s] :: %s" k l))) (when (> (length diverged) 0) (printf "\nNEW divergences (ran, wrong value) — gate FAILS:") (each [l m] (slice diverged 0 (min 40 (length diverged))) @@ -218,8 +222,9 @@ # ACTUAL (matching certify.clj's eval-isolated) -> 2673; delay/force/realized? -> # 2685; deftype (P. args) constructor via host-new var fallback -> 2688; # date/time (Date/Timestamp/SimpleDateFormat/TimeZone) + clojure.edn/read over a -# reader -> 2692. -(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_ZJ_FLOOR") "2696"))) +# reader -> 2692; STM stub + portable line-seq -> 2696; realized? on a lazy-seq + +# conj! 1-arity (transducer-completion identity) -> 2698. +(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_ZJ_FLOOR") "2698"))) (def floor (if (os/getenv "JOLT_CORPUS_LIMIT") 0 base-floor)) (when (or (> (length diverged) 0) (< pass floor)) (printf "REGRESSION: pass %d < floor %d or %d new divergence(s)" pass floor (length diverged)))