This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-19
Channels
- # announcements (2)
- # beginners (12)
- # cider (12)
- # cljsrn (1)
- # clojure (56)
- # clojure-italy (1)
- # clojure-sweden (2)
- # clojure-uk (3)
- # clojured (6)
- # clojurescript (16)
- # cursive (1)
- # data-science (3)
- # datomic (8)
- # emacs (18)
- # figwheel-main (1)
- # graphql (5)
- # jobs (10)
- # luminus (4)
- # nrepl (27)
- # off-topic (5)
- # pathom (7)
- # shadow-cljs (66)
- # sql (40)
- # tools-deps (1)
- # vim (6)
Found it. https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/pprint.clj
However, if I try to use zpring-pprint
I get
Could not locate zprint/core__init.class, zprint/core.clj or zprint/core.cljc on classpath.
I somehow recognize having asked about this before, but can’t remember what the conclusion was. puget and fipp both work. (But give me errors when printing datomic-api results, which is why I want to try zprint)I don’t know where to report this, if it is even something that is possible to fix, but anyway, here’s a test project: https://github.com/PEZ/nrepl-pprint-datomic
I get a bit of different results depending on which pprint function I use. In this mini-project:
puget
throws in the towel with
Error printing return value at clojure.lang.Util/runtimeException (Util.java:221).
Unable to convert: class datomic.btset.BTSet to Object[]
zprint
dumps the whole database, with schemas and all, retaining reader literals.
fipp
also dumps the whole database, but “expands” (or whatever the term is) the reader literals.
clojure.core/pprint
prints the same thing as with no pretty printing. Which is: {:db-before datomic.db.Db@defa54b7, :db-after datomic.db.Db@270efa27, :tx-data [#datom[13194139534318 50 #inst "2019-10-19T12:34:49.714-00:00" 13194139534318 true] #datom[17592186045423 62 "Hello world" 13194139534318 true]], :tempids {-9223301668109598140 17592186045423}}
Those that I have tried are the cider-nrepl ones. Even though I had to provide the dependency on zprint in the test project.
Yeah, no problems with zprint really. It’s a bit strange that I need to include the dependency, but no biggie.
It’s still not the problem. 😃 The issue here is that is I use a pretty printing printer for nrepl.middleware.print/print
with results from Datomic, they print the whole database for things like :db-before datomic.db.Db@defa54b7
. Which surprises the user who probably thought that the result map should just be printed in a tad more readable way. Also, in Calva pretty printing is default, and people can have pretty huge databases.
> I don’t see how this is a pretty printing issue It is an issue at least. Not sure how to categorize it, but if not pretty printing, things do not go crazy.
Wild guess. The db implements IAssoc or something but not a print method and the pretty printers walk it trying to be helpful
> and the pretty printers walk it trying to be helpful It certainly seems to be something like this, because on my work project, evaluating something like
@(d/transact conn [{:db/doc "Hello world"}])
with pretty printing enabled never finishes and the java process heat up my machine like mad.