core: Phase 4 — move tagged-value predicates to the overlay
atom?/volatile?/reader-conditional?/tagged-literal?/record?/chunked-seq? all just read a value's kind from :jolt/type (records from :jolt/deftype), and get returns nil on non-tables, so the predicates are pure over get with no host surface. Constructors stay native. delay?/transient? keep their Janet defns — they have internal callers (force, conj/count/persistent! etc.). chunked-seq? is always false (no chunked seqs until Phase 5). Added a tagged-value spec group covering positive and negative cases for each.
This commit is contained in:
parent
7f68a5872c
commit
f410bec2ec
3 changed files with 33 additions and 15 deletions
|
|
@ -253,3 +253,15 @@
|
|||
:else nil)))
|
||||
(defn ex-cause [e]
|
||||
(let [e (ex-unwrap e)] (if (ex-info-val? e) (get e :cause) nil)))
|
||||
|
||||
;; Tagged-value predicates. The constructors (atom/volatile!/...) stay in Janet,
|
||||
;; but every tagged value carries its kind under :jolt/type (records under
|
||||
;; :jolt/deftype), reachable via get — which is nil on non-tables — so the
|
||||
;; predicates are pure over get and move out of the seed.
|
||||
(defn atom? [x] (= (get x :jolt/type) :jolt/atom))
|
||||
(defn volatile? [x] (= (get x :jolt/type) :jolt/volatile))
|
||||
(defn reader-conditional? [x] (= (get x :jolt/type) :jolt/reader-conditional))
|
||||
(defn tagged-literal? [x] (= (get x :jolt/type) :jolt/tagged-literal))
|
||||
(defn record? [x] (some? (get x :jolt/deftype)))
|
||||
;; Jolt has no chunked seqs (Phase 5 territory), so this is always false.
|
||||
(defn chunked-seq? [x] false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue