Morning
morning!
morning ☕
Mjørn!
Good morning
Has anyone here used zprint to format generated code? zprint/zprint takes S-expressions, so it can format things like '(defn ^:export do-stuff [] (+ 1 1)) , but I lose the metadata. If I instead set :parse-string? true I can do (zprint/zprint "(defn ^:export do-stuff [] (+ 1 1))" {:parse-string? true}) , and it will print and format the metadata. Does anyone know an option to keep metadata on the symbol when passing S-expressions to it?
I could always output the S-expressions to a string first, and then have zprint do its job, but I'd rather not do it in multiple steps.
Not that not all metadata is user written, e.g.
user=> (meta '(+ 1 2 3))
{:line 1, :column 8}
Would you like to have zprint add line and column to the output too? I guess that's where it may be problematic to deal with raw s-exprsor consider:
(let [^String x x])
This is transformed to:
(let [^{:tag 'String} x x])
In other words, s-expressions are lossy with respect to how they were originally writtenYes, I'm aware, but I saw there was filtering in place to remove line and column numbers, and to only print metadata on the second element of a list starting with def/defn. But I haven't been able to get it to use this with any of the built-in styles.
Memory from the conj!