From e7f5bcb58dd49949df652ac786f492d8fd05dc84 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Sun, 21 Jun 2026 17:03:10 -0400 Subject: [PATCH] assoc! fills nil for a trailing lone key (JVM parity) JVM assoc! is variadic: with a complete first pair present (>=3 kvs), a trailing lone key fills nil ((assoc! t :a 1 :b) => {:a 1 :b nil}); a lone key alone (1 kv) is still a wrong-arity throw. jolt delegated to the strict persistent assoc which threw on any odd count. Pad a trailing nil for odd kvs >=3. Corpus 2688->2690. --- host/chez/run-corpus.ss | 4 ++-- host/chez/transients.ss | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/host/chez/run-corpus.ss b/host/chez/run-corpus.ss index 0c97938..417c922 100644 --- a/host/chez/run-corpus.ss +++ b/host/chez/run-corpus.ss @@ -11,7 +11,7 @@ ;; reset between cases so there is no leakage — same isolation a fresh process gives. ;; ;; chez --script host/chez/run-corpus.ss -;; JOLT_CHEZ_ZJ_FLOOR=N override the regression floor (default 2688) +;; JOLT_CHEZ_ZJ_FLOOR=N override the regression floor (default 2690) ;; JOLT_CORPUS_LIMIT=N every-Nth stride (fast iteration; floor drops to 0) ;; JOLT_DUMP_CRASH_LABELS=1 list crash + allowlisted labels (import (chezscheme)) @@ -203,7 +203,7 @@ ;; Regression floor: fail on any NEW divergence or if pass drops below the floor. (define base-floor (let ((s (getenv "JOLT_CHEZ_ZJ_FLOOR"))) - (if s (string->number s) 2688))) + (if s (string->number s) 2690))) (define floor (if limit 0 base-floor)) (when (or (> (length diverged) 0) (< pass floor)) (printf "REGRESSION: pass ~a < floor ~a or ~a new divergence(s)\n" diff --git a/host/chez/transients.ss b/host/chez/transients.ss index 0d6faea..923bddf 100644 --- a/host/chez/transients.ss +++ b/host/chez/transients.ss @@ -38,7 +38,13 @@ ;; (assoc! t k v & kvs): variadic like Clojure (jolt-assoc already folds pairs). (define (jolt-assoc! t . kvs) (jolt-trans-check t "assoc!") - (jolt-transient-coll-set! t (apply jolt-assoc (jolt-transient-coll t) kvs)) + ;; JVM assoc! is variadic: once a complete first key/val pair is present (>=3 + ;; kvs), a TRAILING lone key fills nil; a lone key alone (1 kv) is a wrong-arity + ;; throw (so don't pad it — the persistent assoc raises on odd args). + (let ((kvs (if (and (>= (length kvs) 3) (odd? (length kvs))) + (append kvs (list jolt-nil)) + kvs))) + (jolt-transient-coll-set! t (apply jolt-assoc (jolt-transient-coll t) kvs))) t) (define (jolt-dissoc! t . ks) (jolt-trans-check t "dissoc!")