Chez parity: realized? on lazy-seq + conj! 1-arity identity
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.
This commit is contained in:
parent
32d2028559
commit
53a189541c
4 changed files with 24 additions and 11 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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!")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue