reveal

Docs: https://vlaaad.github.io/reveal/ Source: https://github.com/vlaaad/reveal
Chase 2020-12-18T00:24:05.449400Z

I've been exploring deps.edn as well and I might be confused about this. How do I call both my nrepl alias and the reveal alias (I've set up both using Sean Corfield's setup) such that I can do my normal editing (in vim in my case) connected to the nrepl while it is also sending that data to reveal. I suspect I don't have my head totally wrapped around reveal yet actually, so not sure if it's only an either/or thing. Definitely all seems cool though!

seancorfield 2020-12-18T00:29:18.451200Z

You can start a regular nREPL and then do

(add-tap ((requiring-resolve 'vlaaad.reveal/ui)))
which will start a Reveal UI. Then anything you (tap> ...) will appear in Reveal.

Chase 2020-12-18T15:33:08.485400Z

@sjharms Just a heads up, if you add "-i" to the main opts you get the repl prompt.

seancorfield 2020-12-18T18:03:16.487100Z

-i means "init opts" so it would expect something after it (that you get a REPL is probably just a coincidence that it doesn't error check). -r is the option to specifically start a REPL.

seancorfield 2020-12-18T18:04:08.487300Z

(or do you mean nREPL's command-line? in which case -i probably means "interactive"... pity it uses the same option as clojure.main but for a completely different meaning...)

seancorfield 2020-12-18T00:30:00.451800Z

I suspect you can automate by telling nREPL to execute that expression at startup (consult the nREPL docs).

seancorfield 2020-12-18T00:31:20.453200Z

Here's what I tested locally -- using just my deps.edn setup:

(! 990)-> clj -M:reveal:nrepl
Downloading: vlaaad/reveal/maven-metadata.xml from clojars
Downloading: nrepl/nrepl/maven-metadata.xml from clojars
Downloading: vlaaad/reveal/1.1.178/reveal-1.1.178.pom from clojars
Downloading: nrepl/nrepl/0.8.3/nrepl-0.8.3.pom from clojars
Downloading: vlaaad/reveal/1.1.178/reveal-1.1.178.jar from clojars
Downloading: nrepl/nrepl/0.8.3/nrepl-0.8.3.jar from clojars
nREPL server started on port 58271 on host localhost - <nrepl://localhost:58271>
(that just sits that at that point). In another terminal:
(! 785)-&gt; lein repl :connect 127.0.0.1:58271
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Connecting to nREPL at 127.0.0.1:58271
REPL-y 0.4.4, nREPL 0.8.3
Clojure 1.10.1
OpenJDK 64-Bit Server VM 15+36
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=&gt; (add-tap ((requiring-resolve 'vlaaad.reveal/ui)))
nil
user=&gt; (tap&gt; [[1 2 3] [4 5 6]])
true
user=&gt; 
That data appeared in Reveal.

Chase 2020-12-18T00:31:32.453300Z

Ok, I will try this. That's my other question about deps though which I should probably take over to that channel. When starting the nrepl I don't get a repl prompt like I do when doing the same with lein repl My editor connects fine, but I don't get the prompt

Chase 2020-12-18T00:32:17.454Z

yeah, you are getting the same behavior as me too then. I guess I can just stick with lein for now as I explore Reveal

phronmophobic 2020-12-18T00:33:28.454800Z

there is a section in the docs that covers how to integrate with nrepl: https://vlaaad.github.io/reveal/#nrepl-based-editors

phronmophobic 2020-12-18T00:33:53.455400Z

which I've used successfully

seancorfield 2020-12-18T00:34:24.456200Z

@chase-lambert Remember that I do not type into the REPL! That's why my :nrepl alias only starts a server, that I can connect to from an editor (or attach a lein repl as shown above).

Chase 2020-12-18T00:35:37.457Z

I don't type into a repl either that's why I was wondering if I could keep my normal workflow while also having the data go to Reveal as well

seancorfield 2020-12-18T00:37:04.458100Z

Yeah, that link suggests this (again, using just my setup):

(! 993)-&gt; clj -M:reveal:nrepl --middleware '[vlaaad.reveal.nrepl/middleware]'
that starts the server as before, but with the middleware -- so it will automatically start Reveal.

seancorfield 2020-12-18T00:37:36.458800Z

Now if you connect to that server via an editor or other client, Reveal will echo everything sent to that nREPL server.

phronmophobic 2020-12-18T00:38:04.459100Z

@jr0cket also wrote some helpful tips which he shared at https://practicalli.github.io/clojure/clojure-tools/data-browsers/reveal.html#using-reveal-with-nrepl-editors

seancorfield 2020-12-18T00:38:36.459300Z

Like so:

Chase 2020-12-18T00:40:24.460100Z

awesome, I'll play around with this. Thanks folks. (And I'm excited to see your upcoming talk on your RDD too Sean!)

😊 1
practicalli-john 2020-12-18T01:51:52.472100Z

@chase-lambert I have several aliases for Reveal in practicalli/clojure-deps-edn that may be of interest. clj -M:repl/reveal-nrepl starts the REPL process and runs the basic clojure terminal UI (nREPL interactive mode). Open a Clojure file in vim/neovim and connect via the nREPL server that has started. clojure -M:inspect/reveal-nrepl is the same as above but without a terminal UI. There are light themed versions of these, along with other variations. I've tested these with Neovim and Conjure, but not with fireplace specifically. If anyone has a vim setup they recommend, am happy to test it out or receive feedback on your setup and the practicalli aliases. https://github.com/practicalli/clojure-deps-edn

Chase 2020-12-18T15:01:14.484900Z

Yep, I followed the advice to check this out earlier and got it all worked out. And your config showed me the "-i" option to give me that repl prompt I was looking for. Good stuff

practicalli-john 2020-12-18T15:24:44.485200Z

Thanks. I didnt really understand the -i option until I started experimenting with these aliases πŸ™‚

2020-12-18T04:04:07.472600Z

This sounds silly, but I use that alias and also didn’t realize the server / client distinction

2020-12-18T04:04:12.472800Z

Thank you for sharing

seancorfield 2020-12-18T04:47:29.473500Z

Interesting. The deps.edn file says:

;; - start a modern nREPL server on a random available port:
  :nrepl {:extra-deps {nrepl/nrepl {:mvn/version "RELEASE"}}
          :main-opts ["-m" "nrepl.cmdline"]}
and the README says
:nrepl -- pulls in the latest stable release of nREPL and starts an nREPL server on a random available port
I'd be happy to make it clearer if you can suggest something @sjharms?

seancorfield 2020-12-18T04:47:48.473700Z

(documentation can always be improved!)

2020-12-18T04:51:19.473900Z

I think that is clear, the challenge is in bootstrapping a new clojure workstation: Emacs -> Doom or Space or Prelude, clj command lines (try to search for examples, but then throws warning depending on the commit date), then start a project using clj new (thank you!), then try to do a cider-jack-in, but then realize something like reveal is useful, so then take the combined aliases but unsure if something is stuck processing, or if there should be a blinking prompt

2020-12-18T04:53:14.474100Z

It works great if everyone has a baseline for β€œthis works”, just as beginners with lots of tabs and figuring it out, its easy to sort of skip by that detail

1
seancorfield 2020-12-18T05:00:40.474600Z

There's a (lot of) reason(s) I switched from Emacs/nREPL/CIDER to a simple/modern editor and a plain Socket REPL πŸ™‚

seancorfield 2020-12-18T05:05:32.474800Z

I wish people wouldn't recommend Emacs/nREPL/CIDER to beginners (well, unless they're already using Emacs) and I'm still very sad that "Brave and True" dives straight into Emacs. I mean, I used Emacs for decades... but I never really enjoyed it... and I don't like it when I go to learn a new language and everyone says "Oh, you need to use Editor X for this language!"...

πŸ‘ 2
2020-12-18T05:10:07.475100Z

Ha that sounds like the dream, excited for the video thank you again πŸ™‚

pithyless 2020-12-18T09:01:31.482900Z

Working with large datastructures is non-ideal in the output panel (especially if you've tapped several in quick succession and trying to find to the right one). The structural navigation and screen-clearing helps (thanks!), but if you're tapping a lot of stuff asynchronously it's still hard to get a high-level view of what has happened. When working with these kind of structures, I find myself using atoms and vars a lot more just to help me tidy up my output panel. Are there any existing plans or ideas on somehow "folding" these large outputs or would this be considered a non-goal for the output panel?

pithyless 2020-12-18T09:02:41.484Z

I only ask, because reveal is quickly becoming an essential dev tool for me. :]

❀️ 2
vlaaad 2020-12-18T09:17:43.484100Z

Hi! I was thinking about folding from time to time, I certainly find it very useful, but the ratio of implementation complexity vs leverage this feature provides unfortunately makes it low priority. If you control these data structures, I would suggest putting a :vlaaad.reveal.stream/type ::my-big-data-structure metadata on them and creating custom formatter that shows those as a short summary by default. I described this approach here: https://clojureverse.org/t/reveal-1-0-read-eval-visualize-loop-for-clojure/6560/8?u=vlaaad

πŸ‘ 2
pithyless 2020-12-18T09:31:14.484600Z

ah, I was thinking of doing something like this. Probably a good idea to merge this with some nav/datify sugar. Thanks for linking to the code!

phronmophobic 2020-12-18T17:47:06.486900Z

for medium size data structures, I think treemaps might be a good fit, https://blog.phronemophobic.com/treemap/treemaps-are-awesome.html

πŸ‘€ 3
pithyless 2020-12-18T19:33:54.487700Z

Visualizing Clojure maps with treemaps is an interesting approach, but I think what I'm really missing sometimes is something like Fulcro Inspect's "DB Explorer" for an arbitrary map πŸ™‚

πŸ‘ 1
vlaaad 2020-12-18T20:34:29.488100Z

what's that DB explorer?

vlaaad 2020-12-18T20:35:20.488300Z

https://github.com/fulcrologic/fulcro-inspect#db-tab this one?

pithyless 2020-12-18T20:57:51.488700Z

There's a newer version of the inspector than the one in those screenshots; the DB Explorer is a new tab next to that DB tab.

pithyless 2020-12-18T20:58:03.488900Z

pithyless 2020-12-18T21:05:09.489300Z

It's just a more streamlined and searchable iteration on the original https://github.com/fulcrologic/fulcro-inspect#db-tab

pithyless 2020-12-18T21:06:02.489500Z

(and it does a better job of only showing relevant data on larger maps)

vlaaad 2020-12-18T22:11:56.490500Z

In case you missed it in the #announcements πŸ™‚

vlaaad 2020-12-18T22:20:26.490700Z

hmm, I wish I could see it in action, it's not clear what kind of inspector it is from this screenshot...

vlaaad 2020-12-18T22:28:18.490900Z

found it! https://youtu.be/ng-wxe0PBEg?t=1417

pithyless 2020-12-18T22:34:46.491100Z

> Watching ref as latest value or log of successors? Why not both at the same time! 😍

seancorfield 2020-12-18T22:39:08.492300Z

Updated to it already. I love that if you have multiple tabs in a result panel, you can "preview" quickly via the new popup there -- that is incredibly useful!

wilkerlucio 2020-12-18T22:42:50.492400Z

@vlaaad you can think of DB Explorer as a navigable table view πŸ˜‰

wilkerlucio 2020-12-18T22:43:23.492600Z

I too, as Fulcro Inspect user too, I miss a lot the folding on DB tab (more standard tree view, with folding on collections), and I also use DB Explorer a lot, I think they are complementary tools