rewrite-clj 2021-07-20

that fixed it mostly

yes, print-meta should fix that

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"

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?

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

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

But I will miss e.g. metadata

or.. set print-meta to true