{"id":13591330,"url":"https://github.com/brandonbloom/fipp","last_synced_at":"2025-05-14T01:02:44.873Z","repository":{"id":6317606,"uuid":"7552613","full_name":"brandonbloom/fipp","owner":"brandonbloom","description":"Fast Idiomatic Pretty Printer for Clojure","archived":false,"fork":false,"pushed_at":"2024-10-27T19:08:26.000Z","size":217,"stargazers_count":533,"open_issues_count":9,"forks_count":44,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-31T16:54:39.998Z","etag":null,"topics":["clojure","edn","pprint","pretty-print"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"MrKepzie/Natron","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brandonbloom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-01-11T02:18:25.000Z","updated_at":"2025-03-13T03:57:49.000Z","dependencies_parsed_at":"2024-06-18T15:22:13.599Z","dependency_job_id":"fad2f24d-eb58-489b-8ec4-208e76b2ea14","html_url":"https://github.com/brandonbloom/fipp","commit_stats":{"total_commits":217,"total_committers":21,"mean_commits":"10.333333333333334","dds":"0.16129032258064513","last_synced_commit":"a4cb207f2fec08219a1bba115a69819b2c7a256c"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandonbloom%2Ffipp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandonbloom%2Ffipp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandonbloom%2Ffipp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandonbloom%2Ffipp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brandonbloom","download_url":"https://codeload.github.com/brandonbloom/fipp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248201734,"owners_count":21064182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","edn","pprint","pretty-print"],"created_at":"2024-08-01T16:00:56.225Z","updated_at":"2025-04-10T10:46:57.191Z","avatar_url":"https://github.com/brandonbloom.png","language":"Clojure","funding_links":[],"categories":["Clojure"],"sub_categories":[],"readme":"# Fast Idiomatic Pretty-Printer\n\nFipp is a better pretty printer for Clojure and ClojureScript.\n\nLike clojure.pprint, this pretty printer has a *linear runtime* and uses\n*bounded space*. However, unlike clojure.pprint, Fipp's implementation is\ntuned for great performance and has a functional, data-driven API.\n\nThe data interface is agnostic to the source language. Printers are included\nfor Edn data and Clojure code, but it is easy to create a pretty printer for\nyour own language or documents: Even if they're not made out of Clojure data!\n\nFipp is great for printing large data files and debugging macros, but it is\nnot suitable as a code reformatting tool. ([explanation][4])\n\n\n## Installation\n\nFipp artifacts are [published on Clojars](https://clojars.org/fipp).\n\nTo depend on this version with Lein, add the following to your `project.clj`:\n\n```clojure\n[fipp \"0.6.27\"]\n```\n\nThis version of Fipp works with Clojure 1.7 or newer.\n\nSee [the v0.5 branch](https://github.com/brandonbloom/fipp/tree/v0.5) for\na version of Fipp that works with Clojure 1.6.\n\nClojureScript is supported from build 3269 and up.\n\n\n### Colorization \u0026 REPL Integration\n\n[Puget][2] uses Fipp's engine to provide an alternative, colorizing printer.\n\n[Whidbey][3] integrates Puget in to nREPL via Leiningen, so that every\nevaluation pretty prints in color.\n\n\n## Printer Usage\n\n```clojure\n;; Refer with a rename to avoid collision with your REPL's pprint.\n(require '[fipp.edn :refer [pprint] :rename {pprint fipp}])\n\n(fipp [1 2 3])\n(fipp (range 50))\n(fipp (range 20))\n(fipp (range 20) {:width 10})\n\n(require '[fipp.clojure])\n(fipp.clojure/pprint '(let [foo \"abc 123\"\n                            bar {:x 1 :y 2 :z 3}]\n                        (do-stuff foo (assoc bar :w 4)))\n                    {:width 40})\n```\n\nThe available options are:\n\n- `:width` defaults to `70`.\n- `:writer` defaults to `clojure.core/*out*` (Clojure only).\n- `:print-fn` defaults to `cljs.core/*print-fn*` (ClojureScript only).\n- `:print-length` behaves as and defaults to `clojure.core/*print-length*`.\n- `:print-level` behaves as and defaults to `clojure.core/*print-level*`.\n- `:print-meta` behaves as and defaults to `clojure.core/*print-meta*`.\n\nAny other supported/hidden options are subject to change.\n\n### Conveniences\n\nThe `dbg` macro can be used for convenient \"printf debugging\" of\nsource file, line, expression, and evaluation result to `*err*`.\n\n```clojure\n(require '[fipp.edn :refer [dbg]])\n(dbg (repeat 5 (range 10)))\n```\n\nThis will print:\n\n```\n/path/to/that/file.clj:2\n(repeat 5 (range 10))\n=\u003e\n((0 1 2 3 4 5 6 7 8 9)\n (0 1 2 3 4 5 6 7 8 9)\n (0 1 2 3 4 5 6 7 8 9)\n (0 1 2 3 4 5 6 7 8 9)\n (0 1 2 3 4 5 6 7 8 9))\n```\n\nA Fipp-enabled version of `clojure.repl/pst` is also available:\n\n```\nuser=\u003e (require '[fipp.repl :refer [pst]])\nuser=\u003e (throw (ex-info \"whoops\" {:xs (range 20) :ys (range 20)}))\n\nExceptionInfo whoops  clojure.core/ex-info (core.clj:4617)\nuser=\u003e (fipp.repl/pst)\nExceptionInfo whoops\n{:xs (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19),\n :ys (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)}\n      clojure.core/ex-info (core.clj:4617)\n      clojure.core/ex-info (core.clj:4617)\n      user/eval3185 (form-init1248204588518004004.clj:1)\n      user/eval3185 (form-init1248204588518004004.clj:1)\n      clojure.lang.Compiler.eval (Compiler.java:6927)\n      clojure.lang.Compiler.eval (Compiler.java:6890)\n      clojure.core/eval (core.clj:3105)\n      clojure.core/eval (core.clj:3101)\n      clojure.main/repl/read-eval-print--7408/fn--7411 (main.clj:240)\n      clojure.main/repl/read-eval-print--7408 (main.clj:240)\n      clojure.main/repl/fn--7417 (main.clj:258)\n      clojure.main/repl (main.clj:258)\n```\n\n\n## Fast!\n\nIn my non-scientific testing, it has proven to be at least five times as fast\nas `clojure.pprint`.  It also has the nice property of printing no later than\nhaving consumed the bounded amount of memory, so you see your first few lines\nof output instantaneously.\n\nThe core algorithm is described by Swierstra and Chitil in\n[Linear, Bounded, Functional Pretty-Printing][5].\n\nSwierstra and Chitil's implementation uses lazy evaluation and requires\n[tying the knot](http://www.haskell.org/haskellwiki/Tying_the_Knot) to\ninterleave the measuring and printing phases to achieve the bounded space goal.\n\nHowever, this implementation is instead a port of the strict evaluation\nstrategy as described by Kiselyov, Peyton-Jones, and Sabry in\n[Lazy v. Yield: Incremental, Linear Pretty-printing][6].\n\nClojure's transducers are used to simulate generators and their `yield`\noperator. Unlike lazy reduction, transducers interleave execution of\nmulti-phase transformations by function composition. This enables preservation\nof the bounded-space requirement and eases reasoning about the program's\nbehavior. Additionally, it avoids a lot of intermediate object allocation.\n\n\n## Idiomatic!\n\nClojure's included pretty printer supports pluggable dispatch tables and\nprovides an API for controlling the printing process. The programming model\nis side-effectual. For example, to print a breaking newline, you execute\n`(pprint-newline :linear)`. This means that it's a difficult and tricky\nprocess to write or compose new pretty printers.\n\nFipp, on the other hand, accepts a \"pretty print document\" as input. This\ndocument is similar to HTML markup using [hiccup][7].\n\nHere are some examples:\n\n```clojure\n(require '[fipp.engine :refer (pprint-document)])\n\n(defn ppd [doc]\n  (pprint-document doc {:width 10}))\n\n(ppd [:span \"One\" :line \"Two\" :line \"Three\"])\n\n(ppd [:group \"(do\" [:nest 2 :line \"(step-1)\" :line \"(step-2)\"] \")\"])\n```\n\nIf you want to write your own printer, see\n[doc/primitives.md](doc/primitives.md) for details.\n\n\n## License\n\nCopyright © 2015-2021 Brandon Bloom\n\nDistributed under the Eclipse Public License, the same as Clojure.\n\n\n## Acknowledgements\n\nFipp is fast in part thanks to [YourKit's Java Profiler][1].\n\n\n[1]: http://www.yourkit.com/java/profiler/index.jsp\n[2]: https://github.com/greglook/puget\n[3]: https://github.com/greglook/whidbey\n[4]: https://github.com/brandonbloom/fipp/issues/21#issuecomment-64693415\n[5]: http://kar.kent.ac.uk/24041/1/LinearOlaf.pdf\n[6]: http://www.cs.indiana.edu/~sabry/papers/yield-pp.pdf\n[7]: https://github.com/weavejester/hiccup\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandonbloom%2Ffipp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrandonbloom%2Ffipp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandonbloom%2Ffipp/lists"}