refactor: consolidate transducers, dissolve natives-parity.ss (jolt-jcs7)
natives-parity.ss was a grab-bag (its own header called it 'parity'). Dissolve it
into homes that say what they hold:
- cat -> natives-transduce.ss (was natives-xform.ss, renamed for the
whole transducer surface: volatiles + cat + transduce/sequence)
- transient? -> transients.ss
- rseq -> natives-seq.ss
- hash family -> natives-misc.ss (the public hash API over jolt-hash)
The remainder — the #?() feature set, the reader-conditional + re-matcher tagged-map
ctors, and macroexpand — is a coherent reader/macro runtime-support unit, kept as
natives-reader.ss (np- prefix -> nr-). rt.ss loads + two comment refs updated.
Runtime .ss, no re-mint. make test green; hash/transient?/rseq/cat/macroexpand and
#?() reader features all verified.
This commit is contained in:
parent
a594c9deb4
commit
960d8b6e24
9 changed files with 102 additions and 101 deletions
|
|
@ -144,3 +144,21 @@
|
|||
(loop (fx+ j 1) rest))))))
|
||||
(begin (write-char c out) (loop (fx+ i 1) as))))))))
|
||||
(def-var! "clojure.core" "format" jolt-format)
|
||||
|
||||
;; --- hash family (24-bit masked so int? holds) -------------------------------
|
||||
;; The public hash API over jolt-hash (values.ss). hash-ordered/-unordered-coll
|
||||
;; fold the element hashes the way Clojure's IHash mixers do.
|
||||
(define (nm-h24 x) (bitwise-and (jolt-hash x) #xffffff))
|
||||
(define (nm-hash x) (nm-h24 x))
|
||||
(define (nm-hash-combine a b)
|
||||
(bitwise-and (bitwise-xor (nm-h24 a) (+ (nm-h24 b) #x9e3779)) #xffffff))
|
||||
(define (nm-hash-ordered-coll coll)
|
||||
(let loop ((xs (seq->list (jolt-seq coll))) (h 1))
|
||||
(if (null? xs) h (loop (cdr xs) (bitwise-and (+ (* 31 h) (nm-h24 (car xs))) #xffffff)))))
|
||||
(define (nm-hash-unordered-coll coll)
|
||||
(let loop ((xs (seq->list (jolt-seq coll))) (h 0))
|
||||
(if (null? xs) h (loop (cdr xs) (bitwise-and (+ h (nm-h24 (car xs))) #xffffff)))))
|
||||
(def-var! "clojure.core" "hash" nm-hash)
|
||||
(def-var! "clojure.core" "hash-combine" nm-hash-combine)
|
||||
(def-var! "clojure.core" "hash-ordered-coll" nm-hash-ordered-coll)
|
||||
(def-var! "clojure.core" "hash-unordered-coll" nm-hash-unordered-coll)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue