clojure-europe

Ludger Solbach 2025-12-19T07:28:18.117279Z

Morning

teodorlu 2025-12-19T07:39:56.310869Z

morning!

danieroux 2025-12-19T07:40:14.059569Z

morning

Sardtok 2025-12-19T09:06:28.770809Z

Mjørn!

imre 2025-12-19T11:33:52.599229Z

Good morning

Sardtok 2025-12-19T14:43:52.506139Z

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.

borkdude 2025-12-19T14:46:28.754329Z

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-exprs

borkdude 2025-12-19T14:47:33.347749Z

or 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 written

Sardtok 2025-12-19T19:22:17.074249Z

Yes, 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.

borkdude 2025-12-19T18:31:20.348379Z

Memory from the conj!

9
10
❤️ 15
10