Chez inc 3m: numeric-edge literal emit + variadic assoc!

##Inf/##-Inf/##NaN were emitted to bare inf/-inf/nan, which are unbound symbols in
Chez. emit-const now lowers them to +inf.0/-inf.0/+nan.0. The -e/element printer
renders them inf/-inf/nan (Chez's number->string gives +inf.0), and str renders the
long Clojure forms Infinity/-Infinity/NaN. assoc! is now variadic ((assoc! t k v
& kvs)) like Clojure.

Prelude parity 1382 -> 1407/2497, 0 new divergences. str of inf INSIDE a collection
still wants the long form (needs the Phase-2 recursive str renderer), so
[inf inside coll] is allowlisted. Transducer arities and the cdr-on-()/\p{} regex
gaps are split out to jolt-kxsr/jolt-y1zq.
This commit is contained in:
Yogthos 2026-06-17 22:32:02 -04:00
parent 1826c8b3e9
commit c28b5406ca
7 changed files with 65 additions and 16 deletions

View file

@ -105,7 +105,8 @@ corpus case with all of core present, bucketing the result —
JOLT_CORPUS_LIMIT=200 … (every-Nth stride, fast)
Parity baseline: inc 3j **1220/2497**; 3k (converters, jolt-t6cr) **1326**;
3l (transients, jolt-kl2l) **1382/2497**, 0 NEW divergences (13 allowlisted:
3l (transients, jolt-kl2l) **1382**; 3m (numeric-edge emit + variadic assoc!,
jolt-q3w8) **1407/2497**, 0 NEW divergences (14 allowlisted:
dynamic vars `*ns*`/`*clojure-version*`/`*unchecked-math*`, var/`*ns*` rendering,
class names, eval-order, with-open — all deferred Phase-2 / dynamic-var gaps).
- inc 3k `host/chez/converters.ss`: `str`/`subs`/`vec`/`keyword`/`symbol`/`compare`/
@ -118,11 +119,17 @@ class names, eval-order, with-open — all deferred Phase-2 / dynamic-var gaps).
are redefined to see THROUGH a transient (frequencies/group-by do `(get tm k)` on a
transient map); `vector?` on a transient vector is false, which group-by relies on.
- inc 3m: `##Inf`/`##-Inf`/`##NaN` emitted to bare `inf`/`nan` (unbound in Chez);
emit-const now lowers them to `+inf.0`/`-inf.0`/`+nan.0`, the `-e` printer renders
`inf`/`-inf`/`nan` and `str` renders `Infinity`/`-Infinity`/`NaN` (Clojure). Plus
variadic `assoc!`. (`str` of inf *inside a collection* still wants the long form —
the Phase-2 recursive str renderer — so `[inf inside coll]` is allowlisted.)
The remaining buckets are the punch-list the next increments chase: ~360 emit-fail
(genuine host interop — qualified Java/Janet refs, runtime `defmacro`/`eval`, out of
the analyzer's subset) and ~740 runtime crashes, including `##Inf`/`##NaN` literals →
unbound `inf`/`nan` and seq-prim transducer arities (inc 3m jolt-q3w8), multimethod
dispatch (Phase 2 jolt-9ls5), and more host-coupled natives without a shim.
the analyzer's subset) and ~715 runtime crashes — more host-coupled natives without a
shim, transducer arities (jolt-kxsr), `cdr`-on-`()` and `\p{}` regex classes
(jolt-y1zq), and multimethod dispatch (Phase 2 jolt-9ls5).
Two host shims landed with the prelude. `host/chez/atoms.ss`: atom/deref/swap!/
reset! (+ compare-and-set!/swap-vals!/reset-vals!) — host-coupled mutable cells the

View file

@ -467,6 +467,27 @@
(ok (string "jolt-chez -e: " src) (and (= code 0) (= out want))
(string "chez=" out " janet=" want " | " err)))))
# 3r) numeric-edge literals (jolt-q3w8): ##Inf/##-Inf/##NaN emitted to bare
# inf/nan (unbound on Chez) — fix emit-const to +inf.0/-inf.0/+nan.0, the
# -e printer to inf/-inf/nan, and str to Infinity/-Infinity/NaN (Clojure).
# Value/print cases are pure literals -> subset path (d/run-on-chez).
(each src ["(< 5 ##Inf)" "(> 5 ##-Inf)" "(= ##Inf ##Inf)"
"##Inf" "##-Inf" "##NaN" "[##Inf]" "[##NaN ##-Inf]"]
(let [[code out err] (d/run-on-chez ctx src) want (cli-oracle src)]
(ok (string "numedge: " src) (and (= code 0) (= out want))
(string "chez=" out " janet=" want " | " err))))
# str of inf/nan needs the prelude (str is a converter shim).
(each src ["(str ##Inf)" "(str ##-Inf)" "(str ##NaN)"]
(let [[code out err] (run-prelude src) want (cli-oracle src)]
(ok (string "numedge: " src) (and (= code 0) (= out want))
(string "chez=" out " janet=" want " | " err))))
# variadic assoc! (jolt-q3w8): (assoc! t k v & kvs).
(each src ["(count (persistent! (assoc! (transient {}) :a 1 :b 2 :c 3)))"
"(get (persistent! (assoc! (transient {}) :a 1 :b 2)) :b)"]
(let [[code out err] (run-prelude src) want (cli-oracle src)]
(ok (string "numedge: " src) (and (= code 0) (= out want))
(string "chez=" out " janet=" want " | " err))))
# 4) perf signal: emitted fib(30) in-Scheme timing (excludes Chez startup), to
# track against the spike ceiling (hand-Scheme fib ~5ms). Informational — the
# jolt-truthy? wrapper (~3x) and flonum modeling are known Phase-4 levers.

View file

@ -54,7 +54,12 @@
"*ns* user" true
"str of a var" true
"*clojure-version* major" true
"*unchecked-math*" true})
"*unchecked-math*" true
# (str [##Inf]) wants "[Infinity]" but the Chez -e printer (jolt-pr-str, which
# str falls back to for collections) renders inf as "inf" — str needs a
# recursive long-form renderer, the Phase-2 canonical printer. Top-level
# (str ##Inf) -> "Infinity" already works (jolt-str-render-one).
"inf inside coll" true})
(def ctx (d/make-ctx))
@ -130,8 +135,8 @@
# reach-floor and the suite baseline. The gate fails if parity drops below it, or
# on any NEW (un-allowlisted) divergence — a real Chez correctness regression.
# Full-corpus baseline: inc 3j 1220/2497; 3k (converters) 1326; 3l (transients)
# 1382. Strided runs scale the floor down.
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "1382")))
# 1382; 3m (numeric-edge emit + variadic assoc!) 1407. Strided runs scale down.
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "1407")))
(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)))