Chez Phase 1 (increment 3p): misc seq/regex gaps + bug tracking

jolt-y1zq tail:
- 0-arg (conj) -> [] and 0-arg (conj!) -> a fresh transient vector
- nth sees through a transient (like get/count/contains?)
- irregex \p{...}/\P{...} property classes translate to the seed's ASCII char
  classes (regex.ss): \p{L} -> [a-zA-Z] + non-ASCII codepoints (the seed counts
  UTF-8 high bytes as letters), \p{N} -> [0-9], \p{Ps} -> [([{], etc. The
  translator tracks [...] nesting so a \p{} inside a class emits its content, not
  a nested class.

Two pre-existing bugs found and filed (tracked, not replicated):
- jolt-x0os: the Chez emitter mangles non-ASCII string literals into invalid Chez
  hex escapes (so p{L} utf-8 crashes on the input string, not the regex).
- jolt-ea9k: the seed's transient assoc! accepts odd args and assigns nil to the
  trailing key (non-Clojure; plain assoc throws). The Chez host throws
  (Clojure-correct); the 4 spec rows encoding the leniency are flagged in
  transients-spec.janet pending the seed fix.

Parity 1493 -> 1506/2497, 0 new divergences. emit-test 291/291.
This commit is contained in:
Yogthos 2026-06-18 00:44:21 -04:00
parent cbb0f2ab4a
commit e51cc2e47e
7 changed files with 131 additions and 12 deletions

View file

@ -23,10 +23,14 @@
(jolt-transient-active-set! t #f)
(jolt-transient-coll t))
(define (jolt-conj! t . xs)
(jolt-trans-check t "conj!")
(jolt-transient-coll-set! t (apply jolt-conj (jolt-transient-coll t) xs))
t)
;; (conj!) with no args -> a fresh transient vector (Clojure); otherwise mutate t.
(define (jolt-conj! . args)
(if (null? args)
(jolt-transient-new (jolt-vector))
(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)))
;; (assoc! t k v & kvs): variadic like Clojure (jolt-assoc already folds pairs).
(define (jolt-assoc! t . kvs)
(jolt-trans-check t "assoc!")
@ -63,6 +67,11 @@
(set! jolt-count (lambda (coll) (%prev-jolt-count (jolt-deref-transient coll))))
(define %prev-jolt-contains? jolt-contains?)
(set! jolt-contains? (lambda (coll k) (%prev-jolt-contains? (jolt-deref-transient coll) k)))
(define %prev-jolt-nth jolt-nth)
(set! jolt-nth
(case-lambda
((coll i) (%prev-jolt-nth (jolt-deref-transient coll) i))
((coll i d) (%prev-jolt-nth (jolt-deref-transient coll) i d))))
(def-var! "clojure.core" "transient" jolt-transient-new)
(def-var! "clojure.core" "persistent!" jolt-persistent!)