From 7947918919b123437935f59dc0734b2f45a66932 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Wed, 24 Jun 2026 11:03:34 -0400 Subject: [PATCH] Add File .isAbsolute and the default #inst/#uuid data readers jfile lacked .isAbsolute (path starts with /). clojure.core/default-data-readers and *data-readers* were nil, so a library merging them (aero's reader opts) couldn't resolve #inst. Define them keyed by symbol, like Clojure. --- host/chez/inst-time.ss | 8 ++++++++ host/chez/io.ss | 1 + 2 files changed, 9 insertions(+) diff --git a/host/chez/inst-time.ss b/host/chez/inst-time.ss index 61c310c..f05b726 100644 --- a/host/chez/inst-time.ss +++ b/host/chez/inst-time.ss @@ -388,3 +388,11 @@ ((string=? method-name "after") (> (jinst-ms obj) (ms-of (car (seq->list rest-args))))) (else (error #f (string-append "No method " method-name " on Date"))))) (else (%it-rmd obj method-name rest-args))))) + +;; Clojure's built-in data readers, so a library that merges default-data-readers +;; or binds *data-readers* (e.g. aero's reader opts) resolves #inst / #uuid. +;; Keyed by symbol, like Clojure. *data-readers* is the bindable user table. +(def-var! "clojure.core" "default-data-readers" + (jolt-hash-map (jolt-symbol #f "inst") jolt-inst-from-string + (jolt-symbol #f "uuid") jolt-uuid-from-string)) +(def-var! "clojure.core" "*data-readers*" empty-pmap) diff --git a/host/chez/io.ss b/host/chez/io.ss index 0805bf8..8d0e38b 100644 --- a/host/chez/io.ss +++ b/host/chez/io.ss @@ -100,6 +100,7 @@ ((string=? name "exists") (list (if (file-exists? p) #t #f))) ((string=? name "isDirectory") (list (if (file-directory? p) #t #f))) ((string=? name "isFile") (list (if (and (file-exists? p) (not (file-directory? p))) #t #f))) + ((string=? name "isAbsolute") (list (if (and (> (string-length p) 0) (char=? (string-ref p 0) #\/)) #t #f))) ((string=? name "listFiles") (list (list->cseq (map make-jfile (jolt-list-dir p))))) ((string=? name "getParent") (let loop ((i (- (string-length p) 1)))