rewrite-clj

escherize 2021-07-20T16:34:00.006800Z

that fixed it mostly

borkdude 2021-07-20T16:46:55.007300Z

yes, print-meta should fix that

lread 2021-07-20T16:50:13.008500Z

Hi @escherize, it might not be a typically use case, but yes you can by using coerce:

(require '[rewrite-clj.zip :as z] 
         '[rewrite-clj.node :as n])

(-> '(+ 1 2 3)
    n/coerce
    z/edn
    z/down
    z/right
    z/string)
;; => "1"

lread 2021-07-20T16:54:24.009700Z

An example with metadata:

(-> (with-meta [1 2 3] {:my-meta 4})
    n/coerce
    z/edn
    z/string)
;; => "^{:my-meta 4} [1 2 3]
But.. I think folks don’t typically do this because they are typically interested in preserving whitespace. But… might work for your use case?

escherize 2021-07-20T04:26:47.005600Z

Is there a way to get a clj-rewrite zipper from a quoted form?

escherize 2021-07-20T04:27:04.006Z

Seems like it can only come from a string or a file. I guess I can pr-str a form

escherize 2021-07-20T04:27:26.006300Z

But I will miss e.g. metadata

escherize 2021-07-20T04:28:09.006600Z

or.. set print-meta to true