A new version of zprint, a full function Clojure and Clojurescript code and data pretty printer: https://github.com/kkinnear/zprint is available.
You can use zprint in a variety of ways: - As a "filter" that will accept Clojure(script) source on stdin and produce formatted source on stdout. Even using the JVM it starts up in under 1 second. See* here <https://github.com/kkinnear/zprint/blob/master/doc/filter.md>* for details. - As a library that you use at the repl in order to pretty print Clojure structures or function definitions (with included specs in 1.9.0-beta2). You can type (czprint-fn <function-name>) and see the formatted source of any function (for which (doc ...) works) at the repl. - As a full file reformatter, you can use lein zprint <https://github.com/kkinnear/lein-zprint> to reformat entire source files. When used in this way, you can embed ;!zprint "comments" in the files to alter the formatting as you desire. While zprint does a good job on specs by default, using ;!zprint {:style :spec} at the start of a spec file makes the spec formatting truly excellent. - Using lumo or planck to create a "filter" to format Clojure(script) source. Zprint is configurable by using a ~/.zprintrc file, functions at the repl, or in an options map passed directly to its functions. You can configure the way it prints Clojure source in a wide variety of ways, including some standard "styles" (e.g. :spec, :community) as well as by changing any of the detailed arguments to get code to look the way *you *want it to look. Zprint has a number of heuristics designed to make code look "cleaner", with the goal to make code more understandable. Give it a try and see what you think! Here is one example, using the {:style :justified}, which isn't the default or my normal favorite style, but sometimes it does make things quite a bit clearer: (czprint-fn defn {:width 90 :style :justified}) [this is shifted right because I used an image to preserve the formatting for this posting, it comes out left justified normally] <https://lh3.googleusercontent.com/-hlo0mpVymFI/Wd2ZOr9qo3I/AAAAAAAAAAU/Tf0IkApyL4cSoDhUBGrur8xPmiHbRu0HwCLcBGAs/s1600/Screen%2BShot%2B2017-10-11%2Bat%2B12.02.40%2BAM.png> This illustrates several interesting capabilities of zprint: 1. You can see the pretty printed source for any function for which (doc ...) will work. 2. The "c" in (czprint-fn ...) means "color" the output. This only works at the repl, of course. 3. In Clojure 1.9.0-beta2 zprint will include any specs for the function in the doc-string. Sort of like (doc ...), but it will also format them, and this shows how well zprint will format them by default. 4. This shows a function printed with {:style :justified}, which doesn't always look good, but in this case adds considerable clarity to the local bindings in the let. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@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+unsubscr...@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 the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.