[ANN] zprint, lein-zprint Pretty print your code and data [ALPHA]

225 views
Skip to first unread message

Kim Kinnear

unread,
Oct 6, 2016, 10:39:39 PM10/6/16
to Clojure


I'm pleased to announce the ALPHA release of a new Clojure pretty print library and associated leiningen plugin to apply it to your source files.  The zprint library will pretty print your structures (and code, actually) at the repl, as well as reformat your source files when driven by lein-zprint.


https://github.com/kkinnear/zprint

https://github.com/kkinnear/lein-zprint

 

What, really?  Another pretty printer?

 

Yes, I know.  We've already got clojure.pprint, fipp, puget, cljfmt.

These are all great libraries! There is a full discussion of why zprint exists in the readme.  


The short story is that zprint completely reformats Clojure source, totally ignoring all of the line breaks and whitespace in your files.  It also runs as a library at the repl (and in your code) to print structures very nicely out of the box, and is totally configurable.


In short, zprint and lein-zprint try to do it all, beautifully, out of the box.

 

At present, this is an alpha release because only one other person has ever used zprint, and so it needs some additional people to try it out. I expect the configuration parameters to remain largely stable, as they have been evolving over the past year or so.  New ones will be added, as zprint is still under active development.


When I announce it for real, I'll add some more words to try to convince people to try it, but for now I need some people who care a lot about how their code and s-expressions look to give take it out for a spin.  I'm very interested in your feedback!  You can create an issue on github, or contact me by email (see my overview at github).


Thanks -- Kim

Yehonathan Sharvit

unread,
Oct 7, 2016, 1:16:00 AM10/7/16
to Clojure
Looks very nice!
I'd like to integrate zprint into KLIPSE.
But for that I need zprint to be ported to clojurescript.

Could you do it?

Kim Kinnear

unread,
Oct 7, 2016, 10:10:06 AM10/7/16
to Clojure

But for that I need zprint to be ported to clojurescript.

Could you do it?

A Clojurescript port is certainly something I've been thinking about.  The major underlying library on which zprint depends (rewrite-clj) has a Clojurescript port, so in theory it should all be straightforward.   The configuration environment for Clojurescript is very different.  I've only dabbled in Clojurescript, so I would need to come up with a better development environment than I have used so far to enable me to make substantial progress.  I am interested in which part you think would be interesting -- the part of zprint that pretty prints Clojure (or in your case, Clojurescript) structures, or the part that parses Clojure (or Clojurescript) source and formats that.  Perhaps both.  

For what it is worth (though I know this is not what you are asking), zprint and lein-zprint handle the reader conditionals implicit in .cljc files.  I would expect that they will do ok on clojurescript files too, though I haven't done any testing in that area yet.  I'll be interested to hear if someone gives that a try.

Let's talk offline and explore this in more detail.

Yehonathan Sharvit

unread,
Oct 7, 2016, 10:50:01 AM10/7/16
to Clojure
lein-zprint works fine with cljs files.

Taking it offline for further details

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/am29qj7VHZI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages