Fork me on GitHub
#reveal
<
2023-05-14
>
ognen.ivanovski17:05:05

Hi, I'm tinkering with a customised reveal setup where one of the things I'd like to achieve is to display summarized representation of repl-evalueated forms; ideally one-per line and then use view:value to drill into an object if I am intersted in the details. Any ideas how to achieve that?

vlaaad06:05:34

Yes! There is as streaming fn that was created for this purpose https://github.com/vlaaad/reveal/blob/master/src/vlaaad/reveal.clj#L289-L296

vlaaad06:05:38

For example, this is how Reveal’s prepl output shows prepl errors that are datafied throwables in the VM, but displayed as error summaries that allow showing the datafied throwable https://github.com/vlaaad/reveal/blob/d472efebaafe0ba94034fbe5d2d0a991aae8248e/src/vlaaad/reveal/prepl.clj#L10-L15

ognen.ivanovski07:05:15

Yes, using that one already... Is there something I can use to "shorten" a big form or I should do this manually? Thanks for the help

vlaaad08:05:08

Hmm I don't think there is anything ready

vlaaad08:05:37

Do you have the form as string or asv data structure?

vlaaad08:05:11

If you have a data structure, you can bind *print-length* and *print-level* to small numbers and pr-str the form to something short

ognen.ivanovski09:05:47

Goood idea, thank you! Data structure (a big tree ususally)