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
|
|
@ -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