setting up neanderthal with rebl and cursive

In this post I'll demonstrate how to setup Cognitect's REBL to run nicely in conjunction with Neanderthal. I have been finding working with REBL a real pleasure and I believe it could add a lot to the Clojure ecosystem if it gets some momentum.

The following versions of components will be used:

Java 11

IntelliJ IDEA 2019.1.3

Cursive 1.8.2

Intel MKL 2019.4

Neanderthal 0.25.3

REBL 0.9.172

Setup

I will only mention the complex parts of the configuration as for the most you can follow these three guides to get the majority of the relevant setup done:

MKL mklvars

I usually start all my applications via TMux sessions and I include the initialization of MKL in my .zshrc. In below the CUDA LD path isn't necessary for this post but I've included it as I use CUDA as well.

Project Layout

I include the REBL jar under my resources path as I sometimes use its API from my user.clj. I will demonstrate this more below.

Deps

Note the REBL jar is included with my core deps as oppose to with the rebl alias so I can use the REBL API. We also need to add some additional jvm-opts to get Neanderthal to work with JDK 11.

Cursive Run Config

Datafy Neanderthal

Neanderthal makes heavy use of Protocols and Types which I really like. Two of the implemented Protocols expose functionality that works well with REBLs Datafiable protocol. These allow us to easily expose the contents of a Matrix and its associated metadata.

Stepping Through Expressions

Now when I evaluate a series of Neanderthal expressions in Cursive the expressions are automagically piped off to REBL as well. The Matrix types are now also understood by REBL and rendered nicely along with their metadata.

Cursive

REBL Expressions Pane

REBL Data Pane

Now the meta data we exposed via the extended protocol is displayed in the top panel. The Matrix data is displayed in the lower window.

Using the REBL API

Before running REBL directly via a Cursive config I would fire up REBL through my REPL session and send expressions off to REBL on demand. This is a good solution if you prefer your standard editors REPL for most of your needs and then just use REBL for exploring larger datasets.