Welcome! Please see the About page for a little more info on how this works.

0 votes
in IO by
closed by


I use babashka.fs/glob a lot. It returns a sequence of matches, where each match is a sun.nio.fs.UnixPath. Example:

(require '[babashka.fs :as fs])
(fs/glob "." "*.edn")
;; => [#object[sun.nio.fs.UnixPath 0x7d586fe1 "deps.edn"]
;;     #object[sun.nio.fs.UnixPath 0x6b25665b "bb.edn"]]

I often want to read these files. I often try the following:

(->> (fs/glob "." "*.edn")
    (map slurp))

, before I remember that doesn't work, so I do this instead:

(->> (fs/glob "." "*.edn")
    (map fs/file)
    (map slurp))

. So I would think it would be nice if clojure.core/slurp could support an input argument of type sun.nio.fs.UnixPath.