Chez Phase 1 (increment 3n): seq-native shims + reduced
The dominant prelude-parity crash bucket was 'apply non-procedure jolt-nil': core fns calling seed-native seq fns (core_coll.janet) that have no Chez RT shim, so var-deref returns jolt-nil. A static scan of the assembled prelude turned up 52 referenced-but-undefined clojure.core names. host/chez/natives-seq.ss shims the safe seq fns over the existing seq layer: mapcat, take-while, drop-while, partition (collection arities only — the 1-arg transducer forms are jolt-kxsr), and sort (compare default; a comparator may return a 3-way number or a boolean less-than). reduced/reduced? is a jolt-reduced record in seq.ss that reduce short-circuits on and deref unwraps, so unreduced works. identical? = jolt= (the seed's definition). Deferred list?: a Chez lazy seq and a list are both cseq, so it can't be told apart without a distinct list type — a real divergence risk. Parity 1407 -> 1467/2497, 0 new divergences. emit-test 263/263.
This commit is contained in:
parent
c28b5406ca
commit
739b219d0e
7 changed files with 183 additions and 11 deletions
|
|
@ -17,10 +17,13 @@
|
|||
;; (watches/validators are overlay features layered via jolt.host/ref-put!).
|
||||
(define (jolt-atom-new v . _opts) (make-jolt-atom v))
|
||||
|
||||
;; deref reads an atom; it also unwraps a `reduced` (Clojure @(reduced x) => x,
|
||||
;; which the overlay's `unreduced` relies on). The reduced record is in seq.ss.
|
||||
(define (jolt-deref x)
|
||||
(if (jolt-atom? x)
|
||||
(jolt-atom-val x)
|
||||
(error #f "deref: unsupported reference type" x)))
|
||||
(cond
|
||||
((jolt-atom? x) (jolt-atom-val x))
|
||||
((jolt-reduced? x) (jolt-reduced-val x))
|
||||
(else (error #f "deref: unsupported reference type" x))))
|
||||
|
||||
;; (swap! a f arg*) -> (reset! a (f @a arg*)); f is invoked through jolt-invoke
|
||||
;; (a jolt fn value, keyword, or invokable collection).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue